英文:
Graal VM build error: java.lang.NullPointerException: Cannot invoke "java.util.Set.iterator()" because "triggers" is null
问题
这是一个关于在运行Spring Boot项目的本地Graal构建时遇到空指针异常的错误信息。以下是错误信息的一部分:
java.lang.NullPointerException: Cannot invoke "java.util.Set.iterator()" because "triggers" is null
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ReachabilityHandlerFeature.processReachable(ReachabilityHandlerFeature.java:173)
...
Spring Boot版本: 3.1.1
JDK: Graal VM, JDK 17
平台: MacOS (M2, Aarch64)
Maven插件部分:
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>build-native</id>
<goals>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>test-native</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
...
</plugin>
请注意,这里只提供了错误信息和Maven插件的部分内容,其他部分的翻译已被省略。
英文:
Getting following error while running native graal build for my Spring boot project (migrating to Graal VM). I could not find any working answer to this problem anywhere. Requesting the community to help.
java.lang.NullPointerException: Cannot invoke "java.util.Set.iterator()" because "triggers" is null
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ReachabilityHandlerFeature.processReachable(ReachabilityHandlerFeature.java:173)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ReachabilityHandlerFeature.duringAnalysis(ReachabilityHandlerFeature.java:128)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:770)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:86)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:770)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.AbstractAnalysisEngine.runAnalysis(AbstractAnalysisEngine.java:179)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:767)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:582)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:539)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:408)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:612)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:134)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:94)
Spring Boot version: 3.1.1
JDK: Graal VM, JDK 17
Platform: MacOS (M2, Aarch64)
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>build-native</id>
<goals>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>test-native</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
<configuration>
<fallback>false</fallback>
<buildArgs>
<arg>
--verbose
-Dspring.aot.enabled=true
-H:TraceClassInitialization=true
-H:+ReportExceptionStackTraces
-H:Name=trace-app
-H:DashboardDump=trace-app
-H:+DashboardAll
-H:Class=com.xxx.trace.TraceApplication
--initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback,org.slf4j.MDC,org.slf4j.impl.StaticLoggerBinder
--initialize-at-run-time=io.netty
-Dspring.graal.remove-unused-autoconfig=true
-Dspring.graal.remove-yaml-support=true
</arg>
</buildArgs>
<agent>
<enabled>true</enabled>
<defaultMode>Standard</defaultMode>
<options>
<trackReflectionMetadata>true</trackReflectionMetadata>
</options>
<metadataCopy>
<disabledStages>
<stage>test</stage>
</disabledStages>
<merge>true</merge>
<outputDirectory>/tmp/test-output-dir</outputDirectory>
</metadataCopy>
</agent>
</configuration>
</plugin>
答案1
得分: 1
这是Graal 22.x本地镜像构建器中的已知bug;请参见https://github.com/oracle/graal/issues/5868。
截止至撰写本文时,尚无可用的修复方法。然而,您可以根据该问题的对应关系尝试找到一种解决方法。
显然,这个bug与Graal版本22中新增的RunReachabilityHandlersConcurrently
选项有关。一个可能的解决方法是使用较旧版本的Graal。另一个方法是找出谁在使用这个新选项并进行更改...正如他们在https://github.com/googleapis/gax-java/pull/1815中对googleapis/gax-java
所做的那样。
英文:
This a known bug with / in the Graal 22.x native image builder; see https://github.com/oracle/graal/issues/5868.
At the time of writing, no fix is available. However, you may be able to figure out a work-around based on the issue's correspondence.
Apparently the bug is related to the new RunReachabilityHandlersConcurrently
option added in Graal version 22. One possible work-around might be to use an older version of Graal. Another is to figure out what is using the new option and change it ... as they have done with googleapis/gax-java
according to https://github.com/googleapis/gax-java/pull/1815.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论