构建graalvm本机映像以使胖罐用于春季启动时,发生“未找到导入选择器的访问提示”错误

时间:2020-08-24 04:49:51

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

参考博客:https://blog.codecentric.de/en/2020/06/spring-boot-graalvm-native-image-maven-plugin/

以下是我的应用程序版本信息

  • Spring Boot版本:2.3.3.RELEASE
  • spring-graalvm-native版本:0.7.0
  • native-image-maven-plugin版本:20.1.0

本机图像命令

time native-image \
  -J-Xmx4G \
  -Dspring.native.verbose=true \
  -H:+TraceClassInitialization \
  -H:Name=$ARTIFACT \
  -H:+ReportExceptionStackTraces \
  -H:+ReportUnsupportedElementsAtRuntime \
  -Dspring.graal.missing-selector-hints=warning \
  -Dspring.graal.remove-unused-autoconfig=true \
  -Dspring.graal.remove-yaml-support=true \
  -cp $CP $MAINCLASS;

使用上述命令执行时,会发生以下错误。

Excluding 2 auto-configurations from spring.factories file
Processing spring.factories - EnableAutoConfiguration lists #7 configurations
Fatal error:java.lang.IllegalStateException: java.lang.IllegalStateException: No access hint found for import selector: org.springframework.boot.autoconfigure.ImportAutoConfigurationImportSelector
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
    at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
    at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:463)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:359)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:518)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:117)
Caused by: java.lang.IllegalStateException: No access hint found for import selector: org.springframework.boot.autoconfigure.ImportAutoConfigurationImportSelector
    at org.springframework.graalvm.type.Type.getHints(Type.java:1124)
    at org.springframework.graalvm.support.ResourcesHandler.processType(ResourcesHandler.java:900)
    at org.springframework.graalvm.support.ResourcesHandler.processType(ResourcesHandler.java:1155)
    at org.springframework.graalvm.support.ResourcesHandler.processType(ResourcesHandler.java:817)
    at org.springframework.graalvm.support.ResourcesHandler.checkAndRegisterConfigurationType(ResourcesHandler.java:807)
    at org.springframework.graalvm.support.ResourcesHandler.processSpringFactory(ResourcesHandler.java:741)
    at org.springframework.graalvm.support.ResourcesHandler.processSpringFactories(ResourcesHandler.java:578)
    at org.springframework.graalvm.support.ResourcesHandler.register(ResourcesHandler.java:122)
    at org.springframework.graalvm.support.SpringFeature.beforeAnalysis(SpringFeature.java:78)
    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

我该如何解决?我寻求帮助。

0 个答案:

没有答案