参考ブログ:https ://blog.codecentric.de/en/2020/06/spring-boot-graalvm-native-image-maven-plugin/
以下は私のアプリケーションのバージョン情報です
- スプリング ブート バージョン: 2.3.3.RELEASE
- spring-graalvm-native バージョン: 0.7.0
- ネイティブ イメージ Maven プラグイン バージョン: 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
どうすれば修正できますか?私は助けを求めます。