Expand my Community achievements bar.

SOLVED

JAXBElement Linkage error in AEM 6

Avatar

Level 2

Hi ,

I am using JDK 7 ,AEM 6

I am using axis 1.4.1 to consume a soap service . I have generated  my utility classes using XJC from schema.

I am able to hit the service from osgi after getting string as xml response I am marshalling it to JAXB .where I am getting below error.

Please suggest any solution to this . 

 

 

 org.apache.sling.commons.scheduler.impl.QuartzScheduler Exception during job execution of com.hrdi.scheduler.ATGToDAMScheduler@30fdc9e8 : loader constraint violation: when resolving method "javax.xml.bind.JAXBElement.<init>(Ljavax/xml/namespace/QName;Ljava/lang/Class;Ljava/lang/Object;)V" the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) of the current class, com/hrdi/utils/HoltXmlUtil, and the class loader (instance of <bootloader>) for resolved class, javax/xml/bind/JAXBElement, have different Class objects for the type ava/lang/Object;)V used in the signature
java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.bind.JAXBElement.<init>(Ljavax/xml/namespace/QName;Ljava/lang/Class;Ljava/lang/Object;)V" the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) of the current class, com/hrdi/utils/HoltXmlUtil, and the class loader (instance of <bootloader>) for resolved class, javax/xml/bind/JAXBElement, have different Class objects for the type ava/lang/Object;)V used in the signature
    at com.hrdi.utils.HoltXmlUtil.ConvertToXML(HoltXmlUtil.java:32)
    at com.hrdi.scheduler.MetaDataHelper.invokeATGProductFeedService(MetaDataHelper.java:71)
    at com.hrdi.scheduler.ATGToDAMScheduler.run(ATGToDAMScheduler.java:50)
    at org.apache.sling.commons.scheduler.impl.QuartzJobExecutor.execute(QuartzJobExecutor.java:105)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:207)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

1 Accepted Solution

Avatar

Correct answer by
Level 10

Its not recommended to use AXIS to consume a web service. We recommend using Apache CXF. 

https://helpx.adobe.com/experience-manager/using/creating-cxf-bundles-consume-web.html

View solution in original post

5 Replies

Avatar

Level 10

Hey, this usually happens when there is a conflict with jars. Check this out [1] and see if it helps 

[1] https://forums.aws.amazon.com/thread.jspa?messageID=68759

Avatar

Correct answer by
Level 10

Its not recommended to use AXIS to consume a web service. We recommend using Apache CXF. 

https://helpx.adobe.com/experience-manager/using/creating-cxf-bundles-consume-web.html

Avatar

Level 2

bsloki wrote...

Hey, this usually happens when there is a conflict with jars. Check this out [1] and see if it helps 

[1] https://forums.aws.amazon.com/thread.jspa?messageID=68759

 

 

Hi,

 

Thank you for the reply.It looks like kind of class loading issue and javax.xml.bind is getting loaded from multiple bundle .But I am not sure from where it is coming .I am using jdk 1.7 it is coming with part of jdk. So I am not  adding explicitly anything to bundle class path as well as for compilation .Not sure it is CQ issue or in my bundle.

Avatar

Level 10

As you said, its conflicting with one of the bundle with CQ. Can you raise a support ticket on the same 

Avatar

Level 2

This issue is AEM 6 instance .javax.xml is getting exported from felix.framework which is compiled using java5. My class is getting compiled with JDK 7 .over riding the package export by delegation solved the issue.

 

javax.xml is not getting exported from felix.framework bundle by that and it fixed the issue.