You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems to be related to trying to create a proxy for an Annotation, which is something the JDK does, but maybe in a different way because those ones seem to work (when you ask for MyClass.class.getAnnotation(MyAnnotation.class)). Spring uses synthetic annotations a lot and likes to create the proxy manually in this way, so the NPE is a blocker for a large class of Spring app (using @Value for instance, or @ConfigurationProperties).
[target/demo:25999] classlist: 1,774.59 ms
[target/demo:25999] (cap): 780.59 ms
[target/demo:25999] setup: 1,778.58 ms
Warning: class initialization of class org.apache.commons.logging.LogAdapter$Log4jLog failed with exception java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager. This class will be initialized at run time because either option --report-unsupported-elements-at-runtime or option --allow-incomplete-classpath is used for image building. Use the option --delay-class-initialization-to-runtime=org.apache.commons.logging.LogAdapter$Log4jLog to explicitly request delayed initialization of this class.
[target/demo:25999] analysis: 3,883.40 ms
Fatal error: java.lang.NullPointerException
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:598)
at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:427)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:285)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:407)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:106)
Caused by: java.lang.NullPointerException
at com.oracle.svm.hosted.code.CFunctionSubstitutionProcessor.lookup(CFunctionSubstitutionProcessor.java:44)
at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:389)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:369)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:73)
at com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaMethod(UniverseMetaAccess.java:99)
at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:66)
...
Update: as of #1001 the image build crash has been fixed. The NPE was caused by a missing constructor in our annotation substitution type. Now that constructor is intrinsified into an UnreachedCode node. This, however, only pushes the problem to run time:
Exception in thread "main" com.oracle.svm.core.jdk.UnsupportedFeatureError: Code that was considered unreachable by closed-world analysis was reached
at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:102)
at com.oracle.svm.core.snippets.SnippetRuntime.unreachedCode(SnippetRuntime.java:178)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:739)
at com.sample.App.main(App.java:17)
The underlying problem, i.e., allocating of annotation proxy instances at runtime, requires more work.
cstancu
changed the title
NPE during native image generation in app that creates dynamic proxy
Allocate annotation proxy instances at runtime
Mar 7, 2019
This is fixed by 1a68d88. This changeset maintains the optimized implementation for ahead-of-time allocated annotation instances, but it also preserves the default JDK implementation for run-time allocated annotations. See this comment for more details.
Seems to be related to trying to create a proxy for an
Annotation
, which is something the JDK does, but maybe in a different way because those ones seem to work (when you ask forMyClass.class.getAnnotation(MyAnnotation.class)
). Spring uses synthetic annotations a lot and likes to create the proxy manually in this way, so the NPE is a blocker for a large class of Spring app (using@Value
for instance, or@ConfigurationProperties
).Simple sample code: https://github.com/sdeleuze/graal-issues/tree/master/config-props
The text was updated successfully, but these errors were encountered: