Graal VM build error: java.lang.NullPointerException: Cannot invoke "java.util.Set.iterator()" because "triggers" is null

huangapple go评论166阅读模式
英文:

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 &quot;java.util.Set.iterator()&quot; because &quot;triggers&quot; 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)

&lt;plugin&gt;
				&lt;groupId&gt;org.graalvm.buildtools&lt;/groupId&gt;
				&lt;artifactId&gt;native-maven-plugin&lt;/artifactId&gt;
				&lt;extensions&gt;true&lt;/extensions&gt;
				&lt;executions&gt;
					&lt;execution&gt;
						&lt;id&gt;build-native&lt;/id&gt;
						&lt;goals&gt;
							&lt;goal&gt;compile-no-fork&lt;/goal&gt;
						&lt;/goals&gt;
						&lt;phase&gt;package&lt;/phase&gt;
					&lt;/execution&gt;
					&lt;execution&gt;
						&lt;id&gt;test-native&lt;/id&gt;
						&lt;goals&gt;
							&lt;goal&gt;test&lt;/goal&gt;
						&lt;/goals&gt;
						&lt;phase&gt;test&lt;/phase&gt;
					&lt;/execution&gt;
				&lt;/executions&gt;
				&lt;configuration&gt;
					&lt;fallback&gt;false&lt;/fallback&gt;
					&lt;buildArgs&gt;
						&lt;arg&gt;
							--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
						&lt;/arg&gt;
					&lt;/buildArgs&gt;
					&lt;agent&gt;
						&lt;enabled&gt;true&lt;/enabled&gt;
						&lt;defaultMode&gt;Standard&lt;/defaultMode&gt;
						&lt;options&gt;
							&lt;trackReflectionMetadata&gt;true&lt;/trackReflectionMetadata&gt;
						&lt;/options&gt;
						&lt;metadataCopy&gt;
							&lt;disabledStages&gt;
								&lt;stage&gt;test&lt;/stage&gt;
							&lt;/disabledStages&gt;
							&lt;merge&gt;true&lt;/merge&gt;
							&lt;outputDirectory&gt;/tmp/test-output-dir&lt;/outputDirectory&gt;
						&lt;/metadataCopy&gt;
					&lt;/agent&gt;
				&lt;/configuration&gt;
			&lt;/plugin&gt;

答案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.

huangapple
  • 本文由 发表于 2023年7月24日 16:35:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76752710.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定