Skip to content

Reflection metadata missing in JSONPath lookup for application module identifiers on GraalVM #1250

Closed
@ryleighmikami

Description

@ryleighmikami

Hello team,

Just wanted to reach out with an issue.

I am trying to build a spring modulith application, as a native image.

Just to emphasize, this issue only happens when it is a native image.
A normal application runs fine.

When building the application as a native image through mvn -Pnative spring-boot:build-image the build is ok.

However, at run time, reproducible 100%, I can observe this issue:

Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationModuleIdentifiers': Instantiation of supplied bean failed
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1263)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1200)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:569)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:529)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:339)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:373)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:337)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.instantiateSingleton(DefaultListableBeanFactory.java:1222)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingleton(DefaultListableBeanFactory.java:1188)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:1123)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:987)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:627)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:318)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1362)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1351)
	at com.nvidia.nvtelemetry.event.EventApplication.main(EventApplication.java:10)
	at java.base@24.0.1/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: org.springframework.modulith.runtime.jsonpath.InvalidPathException: Function of name: keys cannot be created
	at org.springframework.modulith.runtime.jsonpath.internal.function.PathFunctionFactory.newFunction(PathFunctionFactory.java:84)
	at org.springframework.modulith.runtime.jsonpath.internal.path.FunctionPathToken.evaluate(FunctionPathToken.java:39)
	at org.springframework.modulith.runtime.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:66)
	at org.springframework.modulith.runtime.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:99)
	at org.springframework.modulith.runtime.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:107)
	at org.springframework.modulith.runtime.jsonpath.JsonPath.read(JsonPath.java:179)
	at org.springframework.modulith.runtime.jsonpath.internal.JsonContext.read(JsonContext.java:88)
	at org.springframework.modulith.runtime.jsonpath.internal.JsonContext.read(JsonContext.java:77)
	at org.springframework.modulith.runtime.autoconfigure.ApplicationModuleMetadata$ResourceBasedApplicationModuleMetadata.getIdentifiers(ApplicationModuleMetadata.java:125)
	at org.springframework.modulith.runtime.autoconfigure.SpringModulithRuntimeAutoConfiguration.applicationModuleIdentifiers(SpringModulithRuntimeAutoConfiguration.java:118)
	at org.springframework.modulith.runtime.autoconfigure.SpringModulithRuntimeAutoConfiguration__BeanDefinitions.lambda$getApplicationModuleIdentifiersInstanceSupplier$0(SpringModulithRuntimeAutoConfiguration__BeanDefinitions.java:96)
	at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68)
	at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54)
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$2(BeanInstanceSupplier.java:225)
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58)
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46)
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:258)
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:225)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:1031)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1257)
	... 20 more
Caused by: java.lang.InstantiationException: org.springframework.modulith.runtime.jsonpath.internal.function.json.KeySetFunction
	at java.base@24.0.1/java.lang.Class.newInstance(DynamicHub.java:705)
	at org.springframework.modulith.runtime.jsonpath.internal.function.PathFunctionFactory.newFunction(PathFunctionFactory.java:82)
	... 39 more
Caused by: java.lang.NoSuchMethodException: org.springframework.modulith.runtime.jsonpath.internal.function.json.KeySetFunction.<init>()
	at java.base@24.0.1/java.lang.Class.checkConstructor(DynamicHub.java:1189)
	at java.base@24.0.1/java.lang.Class.getConstructor0(DynamicHub.java:1386)
	at java.base@24.0.1/java.lang.Class.newInstance(DynamicHub.java:698)

Could you please provide guidance on this issue?

Does this repo needs to be registered / reported here? https://github.com/oracle/graalvm-reachability-metadata

Thank you for your time reading this.

Good day

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions