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

native compilation error with version 2.17.0 of com.fasterxml.jackson.dataformat:jackson-dataformat-xml #645

Open
c-schmitz-tsystems opened this issue Mar 13, 2024 · 3 comments

Comments

@c-schmitz-tsystems
Copy link

c-schmitz-tsystems commented Mar 13, 2024

Running Quarkus native-image plugin on MANDREL 23.1.2.0 JDK 21.0.2+13-LTS

Error: Unsupported features in 2 methods
Detailed message:
Error: Discovered unresolved method during parsing: com.fasterxml.jackson.databind.PropertyName.merge(com.fasterxml.jackson.databind.PropertyName, com.fasterxml.jackson.databind.PropertyName). This error is reported at image build time because class com.fasterxml.jackson.dataformat.xml.JacksonXmlAnnotationIntrospector is registered for linking at image build time by command line and command line.
Error encountered while parsing com.fasterxml.jackson.dataformat.xml.JacksonXmlAnnotationIntrospector.findNameForDeserialization(JacksonXmlAnnotationIntrospector.java:213) 
Parsing context:
   at com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair.findNameForDeserialization(AnnotationIntrospectorPair.java:768)
   at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addSetterMethod(POJOPropertiesCollector.java:868)
   at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addMethods(POJOPropertiesCollector.java:767)
   at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.collectAll(POJOPropertiesCollector.java:447)
   at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getAnySetterField(POJOPropertiesCollector.java:354)
   at com.fasterxml.jackson.databind.introspect.BasicBeanDescription.findAnySetterAccessor(BasicBeanDescription.java:320)
   at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.addBeanProps(BeanDeserializerFactory.java:546)
   at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBuilderBasedDeserializer(BeanDeserializerFactory.java:337)
   at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBuilderBasedDeserializer(BeanDeserializerFactory.java:170)
   at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:364)
   at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:285)
   at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:265)
   at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:163)
   at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:669)
   at com.fasterxml.jackson.databind.ObjectReader._prefetchRootDeserializer(ObjectReader.java:2450)
   at com.fasterxml.jackson.databind.ObjectReader.<init>(ObjectReader.java:194)
   at com.fasterxml.jackson.databind.ObjectMapper._newReader(ObjectMapper.java:795)
   at com.fasterxml.jackson.databind.ObjectMapper.reader(ObjectMapper.java:4287)
   at org.jboss.resteasy.reactive.server.jackson.JacksonBasicMessageBodyReader.<init>(JacksonBasicMessageBodyReader.java:25)
   at io.quarkus.resteasy.reactive.jackson.runtime.serialisers.FullyFeaturedServerJacksonMessageBodyReader.<init>(FullyFeaturedServerJacksonMessageBodyReader.java:51)
   at io.quarkus.resteasy.reactive.jackson.runtime.serialisers.FullyFeaturedServerJacksonMessageBodyReader_Bean.doCreate(Unknown Source)
   at io.quarkus.resteasy.reactive.jackson.runtime.serialisers.FullyFeaturedServerJacksonMessageBodyReader_Bean.create(Unknown Source)
   at io.quarkus.resteasy.reactive.jackson.runtime.serialisers.FullyFeaturedServerJacksonMessageBodyReader_Bean.create(Unknown Source)
   at io.quarkus.arc.impl.DependentContext.get(DependentContext.java:31)
   at io.quarkus.jackson.runtime.JacksonSupport_fRqO007voVblR_BoQkAFpaGPHtI_Synthetic_Bean.get(Unknown Source)
   at io.quarkus.jackson.runtime.JacksonSupport_fRqO007voVblR_BoQkAFpaGPHtI_Synthetic_Bean.get(Unknown Source)
   at io.quarkus.jackson.runtime.ObjectMapperProducer_ProducerMethod_objectMapper_0pJSAzCVhvpc3iOoOyAlWRwtODI_Bean.doCreate(Unknown Source)
   at io.quarkus.jackson.runtime.ObjectMapperProducer_ProducerMethod_objectMapper_0pJSAzCVhvpc3iOoOyAlWRwtODI_Bean.create(Unknown Source)
   at io.quarkus.jackson.runtime.ObjectMapperProducer_ProducerMethod_objectMapper_0pJSAzCVhvpc3iOoOyAlWRwtODI_Bean.create(Unknown Source)
   at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:119)
   at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:38)
   at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
   at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:32)
   at io.quarkus.arc.impl.ArcContainerImpl.getMatchingRemovedBeans(ArcContainerImpl.java:783)
   at io.quarkus.arc.impl.ArcContainerImpl.scanRemovedBeans(ArcContainerImpl.java:797)
   at io.quarkus.arc.impl.ArcContainerImpl.getBean(ArcContainerImpl.java:580)
   at io.quarkus.arc.impl.ArcContainerImpl.instanceHandle(ArcContainerImpl.java:529)
   at io.quarkus.arc.impl.ArcContainerImpl.instance(ArcContainerImpl.java:294)
   at io.quarkus.hibernate.orm.panache.common.runtime.AbstractJpaOperations.getEntityManager(AbstractJpaOperations.java:63)
   at io.quarkus.hibernate.orm.panache.common.runtime.AbstractJpaOperations.getEntityManager(AbstractJpaOperations.java:53)
   at io.quarkus.hibernate.orm.panache.common.runtime.AbstractJpaOperations.persist(AbstractJpaOperations.java:107)
   at io.quarkus.hibernate.orm.panache.PanacheEntityBase.persist(PanacheEntityBase.java:730)
   at static root method.(Unknown Source)
@cowtowncoder
Copy link
Member

cowtowncoder commented Jun 25, 2024

This could be a version discrepancy with your set up (older version of jackson-databind, pre-2.17)? Method referenced in exception was added in 2.17, I think. So it could be that 2.17 of jackson-dataformat-xml was being compiled against jackson-databind of 2.16 or earlier.

Other than that, I don't think there is anything this module can do about the issue: it would probably require your adding of reference to some type to retain for Native image.

@rpkyrych
Copy link

@c-schmitz-tsystems hi there.
I faced that problem today and found the cause and the solution.

The method com.fasterxml.jackson.databind.PropertyName.merge(com.fasterxml.jackson.databind.PropertyName, com.fasterxml.jackson.databind.PropertyName) that is being invoked was introduced in Jackson v2.17.0 and the issue appears when jackson-databind version is less than the dataformat-xml.

In my case, spring-boot-starter-json was loading it with version 2.15.4.

And the solution was to make those dependencies having the identical versions: 2.15.4 or 2.17.0

@cowtowncoder
Copy link
Member

Thank you for sharing @rpkyrych. This makes sense.

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

No branches or pull requests

3 participants