Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Proposals » OSGi Enterprise Tools » LinkageError: loader constraint violation(Different Class objects for the type javax/xml/namespace/NamespaceContext used in the signature)
LinkageError: loader constraint violation [message #1839910] Wed, 31 March 2021 19:53
amit phadke is currently offline amit phadkeFriend
Messages: 1
Registered: March 2021
Junior Member
Am using org.docx4j.Docx4J in a desktop application for converting WORD file to PDF and it all works fine.

The same desktop application, when launched as an OSGi plug-in, throws NoClassDefFoundError: javax/xml/bind/JAXBException for the above mentioned conversion.

Upon adding the below dependencies:

implementation group: 'org.docx4j', name: 'docx4j-JAXB-Internal', version: '8.2.8'
implementation group: 'org.docx4j', name: 'docx4j-JAXB-ReferenceImpl', version: '8.2.8'
implementation group: 'org.docx4j', name: 'docx4j-JAXB-MOXy', version: '8.2.8'

I get the below error:

java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.xml.stream.XMLStreamReader.getNamespaceContext()Ljavax/xml/namespace/NamespaceContext;"
the class loader "<unnamed>" (instance of org.apache.felix.framework.BundleWiringImpl$BundleClassLoader@2dd2e270,
child of sun.misc.Launcher$AppClassLoader@277050dc) of the current class, org/eclipse/persistence/internal/oxm/record/namespaces/UnmarshalNamespaceContext,
and the class loader <bootstrap> for the method's defining class, javax/xml/stream/XMLStreamReader,
have different Class objects for the type javax/xml/namespace/NamespaceContext used in the signature

at org.eclipse.persistence.internal.oxm.record.namespaces.UnmarshalNamespaceContext.getPrefix(UnmarshalNamespaceContext.java:58)
at org.eclipse.persistence.internal.oxm.record.UnmarshalRecordImpl.resolveNamespaceUri(UnmarshalRecordImpl.java:1338)
at org.eclipse.persistence.internal.oxm.SAXFragmentBuilder.startElement(SAXFragmentBuilder.java:78)
at org.eclipse.persistence.internal.oxm.XMLRelationshipMappingNodeValue.setupHandlerForKeepAsElementPolicy(XMLRelationshipMappingNodeValue.java:231)
at org.eclipse.persistence.internal.oxm.XMLAnyObjectMappingNodeValue.startElement(XMLAnyObjectMappingNodeValue.java:179)
at org.eclipse.persistence.internal.oxm.record.UnmarshalRecordImpl.startElement(UnmarshalRecordImpl.java:864)
at org.eclipse.persistence.internal.oxm.record.XMLStreamReaderReader.parseEvent(XMLStreamReaderReader.java:138)
at org.eclipse.persistence.internal.oxm.record.XMLStreamReaderReader.parse(XMLStreamReaderReader.java:102)
at org.eclipse.persistence.internal.oxm.record.XMLStreamReaderReader.parse(XMLStreamReaderReader.java:89)
at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:940)
at org.eclipse.persistence.internal.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:655)
at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:637)
at org.docx4j.convert.in.FlatOpcXmlImporter.<init>(FlatOpcXmlImporter.java:132)

Please advise! Thanks in advance!
Previous Topic:How to map Antlr to Eclipse editor plugin
Next Topic:Verify/detect errors in interactions between GUI elements
Goto Forum:
  


Current Time: Sun Sep 19 12:11:48 GMT 2021

Powered by FUDForum. Page generated in 0.02152 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top