1

使用带有 java17 的 spring boot 2.6.2 尝试创建本机映像,但失败并出现以下错误。

我正在安装了 docker 桌面的 Windows 11 机器上构建它

mvnw spring-boot:build-image

[INFO]     [creator]     [/layers/paketo-buildpacks_native-image/native-image/com.example.shoppinglist.ShoppinglistApplication:204]    classlist:  10,121.42 ms,  1.20 GB
[INFO]     [creator]     20:58:34.611 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider
[INFO]     [creator]     [/layers/paketo-buildpacks_native-image/native-image/com.example.shoppinglist.ShoppinglistApplication:204]        (cap):     773.97 ms,  1.70 GB
[INFO]     [creator]     Warning: Could not register org.springframework.boot.actuate.web.mappings.reactive.RequestMappingConditionsDescription: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: org/springframework/web/reactive/result/method/RequestMappingInfo.
[INFO]     [creator]     Warning: Could not register org.springframework.boot.actuate.web.mappings.reactive.RequestMappingConditionsDescription$MediaTypeExpressionDescription: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: org/springframework/web/reactive/result/condition/MediaTypeExpression.
[INFO]     [creator]     [/layers/paketo-buildpacks_native-image/native-image/com.example.shoppinglist.ShoppinglistApplication:204]        setup:   3,523.59cation:204]        setup:   3,523.59 ms,  1.70 GB
[INFO]     [creator]     Warning: Could not register complete reflection metadata for org.springframework.boot.actuate.web.mappings.reactive.RequestMappingConditionsDescription. Reason(s): java.lang.NoClassDefFoundError: org/springframework/web/reactive/result/method/RequestMappingInfo
[INFO]     [creator]     Warning: Could not register complete reflection metadata for org.springframework.boot.actuate.web.mappings.reactive.RequestMappingConditionsDescription$MediaTypeExpressionDescription. Reason(s): java.lang.NoClassDefFoundError: org/springframework/web/reactive/result/condition/MediaTypeExpression
[INFO]     [creator]     Error: Image build request failed with exit status 137
[INFO]     [creator]     unable to invoke layer creator
[INFO]     [creator]     unable to contribute native-image layer
[INFO]     [creator]     error running build
[INFO]     [creator]     exit status 137
[INFO]     [creator]     ERROR: failed to build: exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  04:47 min
[INFO] Finished at: 2022-01-19T02:30:19+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.2:build-image (default-cli) on project shoppinglist: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.6.2:build-image failed: Builder lifecycle 'creator' failed with status code 145 -> [Help 1]
[ERROR]
4

1 回答 1

0

创建本机图像会消耗大量内存。当系统内存不足时会出现此消息。

在此官方文档中,您可以找到与此错误相关的一些提示和技巧:

https://docs.spring.io/spring-native/docs/0.11.1/reference/htmlsingle/#_out_of_memory_error_when_building_the_native_image

于 2022-01-19T00:45:58.857 回答