Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in LocalizationFeature when resource-config.json contains class which is not in classpath #9345

Closed
shmyer opened this issue Jul 22, 2024 · 2 comments
Assignees

Comments

@shmyer
Copy link

shmyer commented Jul 22, 2024

I got this error when updating dependencies in my project without regenerating the resource-config.json:

com.oracle.svm.core.util.VMError$HostedError: InternalFeature defined by com.oracle.svm.hosted.ResourcesFeature unexpectedly failed with a(n) java.lang.NullPointerException
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:86)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.handleFeatureError(FeatureHandler.java:287)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:92)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:773)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:592)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:544)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:726)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:143)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98)
Caused by: java.lang.NullPointerException
	at java.base/java.lang.Class.isAssignableFrom(Native Method)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.jdk.localization.LocalizationFeature.prepareClassResourceBundle(LocalizationFeature.java:547)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ResourcesFeature$ResourcesRegistryImpl.lambda$addClassBasedResourceBundle$3(ResourcesFeature.java:189)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ConditionalConfigurationRegistry.registerConditionalConfiguration(ConditionalConfigurationRegistry.java:43)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ResourcesFeature$ResourcesRegistryImpl.addClassBasedResourceBundle(ResourcesFeature.java:189)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.configure.ResourceConfigurationParser.parseBundle(ResourceConfigurationParser.java:121)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.configure.ResourceConfigurationParser.parseTopLevelObject(ResourceConfigurationParser.java:95)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.configure.ResourceConfigurationParser.parseAndRegister(ResourceConfigurationParser.java:52)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.configure.ConfigurationParser.parseAndRegister(ConfigurationParser.java:73)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ConfigurationParserUtils.doParseAndRegister(ConfigurationParserUtils.java:130)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ConfigurationParserUtils.lambda$parseAndRegisterConfigurations$2(ConfigurationParserUtils.java:116)
	at java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:214)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ConfigurationParserUtils$1.tryAdvance(ConfigurationParserUtils.java:109)
	at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:332)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
	at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:515)
	at java.base/java.util.stream.IntPipeline.sum(IntPipeline.java:473)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:118)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:75)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ResourcesFeature.beforeAnalysis(ResourcesFeature.java:217)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$9(NativeImageGenerator.java:773)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:90)
	... 7 more

com.oracle.svm.driver.NativeImage$NativeImageError
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.showError(NativeImage.java:2309)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.build(NativeImage.java:1886)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1845)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.main(NativeImage.java:1827)
	at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

After some digging in the code referenced in the stacktrace I found out, that it might have to do with my resource-config.json being outdated and containing a class name which is not on the classpath anymore. However, this shouldn't make the build fail but rather a warning should be printed.

The corresponding code should be here. A check for bundleClass being null should probably be added.

@shmyer shmyer changed the title NPE in LocalizationFeature when classNames array contains class which is not in classpath NPE in LocalizationFeature when resource-config.json contains class which is not in classpath Jul 22, 2024
@fernando-valdez fernando-valdez self-assigned this Jul 23, 2024
@fernando-valdez
Copy link
Member

Can you please confirm if the error persists if you generate the config files again after the updating the dependencies?

@fernando-valdez
Copy link
Member

Closing issue due to lack of response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants