带有H2驱动程序的spring-boot fat jar无法构建graalvm本机映像

时间:2020-06-27 05:37:40

标签: spring-boot h2 graalvm-native-image

我无法将具有h2驱动程序的spring-boot fat jar转换为graalvm本机映像,以下是异常消息:

Excluding 0 auto-configurations from spring.factories file
Processing existing META-INF/spring.components files...
Registered 15 entries
Configuring initialization time for specific types and packages:
#87 buildtime-init-classes   #23 buildtime-init-packages   #33 runtime-init-classes    #1 runtime-init-packages

Error: Incompatible change of initialization policy for org.springframework.boot.validation.MessageInterpolatorFactory: trying to change RUN_TIME from the command line to BUILD_TIME from feature org.springframework.graalvm.support.InitializationHandler.register
com.oracle.svm.core.util.UserError$UserException: Incompatible change of initialization policy for org.springframework.boot.validation.MessageInterpolatorFactory: trying to change RUN_TIME from the command line to BUILD_TIME from feature org.springframework.graalvm.support.InitializationHandler.register
    at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
    at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:98)
    at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:112)
    at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:112)
    at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:112)
    at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:112)
    at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:112)
    at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insert(ClassInitializationConfiguration.java:63)
    at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.initializeAtBuildTime(ConfigurableClassInitialization.java:392)
    at org.graalvm.nativeimage.hosted.RuntimeClassInitialization.initializeAtBuildTime(RuntimeClassInitialization.java:118)
    at org.springframework.graalvm.support.InitializationHandler.register(InitializationHandler.java:52)
    at org.springframework.graalvm.support.SpringFeature.beforeAnalysis(SpringFeature.java:79)
    at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:679)
    at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
    at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:679)
    at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:538)
    at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:451)
    at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.097 s
[INFO] Finished at: 2020-06-27T11:41:49+08:00
[INFO] Final Memory: 53M/1388M
[INFO] ------------------------------------------------------------------------

我确实先使用代理运行了它以获取配置文件,并在“ native-image-maven-plugin”配置中包含“ -H:ConfigurationResourceRoots = nativeimage”。

我的构建环境中使用的模块版本: Excluding 0 auto-configurations from spring.factories file Processing existing META-INF/spring.components files... Registered 15 entries Configuring initialization time for specific types and packages: #87 buildtime-init-classes #23 buildtime-init-packages #33 runtime-init-classes #1 runtime-init-packages Error: Incompatible change of initialization policy for org.springframework.boot.validation.MessageInterpolatorFactory: trying to change RUN_TIME from the command line to BUILD_TIME from feature org.springframework.graalvm.support.InitializationHandler.register com.oracle.svm.core.util.UserError$UserException: Incompatible change of initialization policy for org.springframework.boot.validation.MessageInterpolatorFactory: trying to change RUN_TIME from the command line to BUILD_TIME from feature org.springframework.graalvm.support.InitializationHandler.register at com.oracle.svm.core.util.UserError.abort(UserError.java:68) at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:98) at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:112) at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:112) at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:112) at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:112) at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:112) at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insert(ClassInitializationConfiguration.java:63) at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.initializeAtBuildTime(ConfigurableClassInitialization.java:392) at org.graalvm.nativeimage.hosted.RuntimeClassInitialization.initializeAtBuildTime(RuntimeClassInitialization.java:118) at org.springframework.graalvm.support.InitializationHandler.register(InitializationHandler.java:52) at org.springframework.graalvm.support.SpringFeature.beforeAnalysis(SpringFeature.java:79) at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:679) at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70) at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:679) at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:538) at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:451) at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) Error: Image build request failed with exit status 1 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 24.097 s [INFO] Finished at: 2020-06-27T11:41:49+08:00 [INFO] Final Memory: 53M/1388M [INFO] ------------------------------------------------------------------------

这可以通过配置解决吗?

编辑@ 2020/07/01-
出现以下错误,
spring-boot-starter-parent:2.4.0-SNAPSHOT
spring-graalvm-native:0.8.0-SNAPSHOT


native-image-maven-plugin: 20.1.0
spring-graalvm-native: 0.7.0
graal-sdk: 20.1.0
spring-boot-starter-parent: 2.3.0.RELEASE
spring-context-indexer
native-image-maven-plugin: 20.1.0
spring-graalvm-native: 0.7.0
graal-sdk: 20.1.0
spring-boot-starter-parent: 2.3.0.RELEASE
spring-context-indexer

编辑@ 2020/07/02-
当我尝试在构建时初始化“意外初始化”的类时,出现以下错误。

<buildArgs>-H:+ReportExceptionStackTraces -H:+TraceClassInitialization --allow-incomplete-classpath -H:+RemoveSaturatedTypeFlows -R:MaxHeapSize=16g -J-Xmx16G</buildArgs>

以不同的呼叫路径重复6次。

0 个答案:

没有答案