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