dineshkumar
dineshkumar

Reputation: 21

Jboss LinkageError: loader constraint violation: when resolving overridden method

I have two war files: A and B with web services using CXF

A uses web service in B.

B uses web service in A.

Everything is working fine in Tomcat. But when i deployed in Jboss, i am facing linkage error.

Caused by: java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.apache.cxf.jaxws.ServiceImpl.createDispatch(Ljavax/xml/ws/EndpointReference;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;[Ljavax/xml/ws/WebServiceFeature;)Ljavax/xml/ws/Dispatch;" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/apache/cxf/jaxws/ServiceImpl, and its superclass loader (instance of ), have different Class objects for the type javax/xml/bind/JAXBContext used in the signature

I have removed jaxb-api-2.2.3.jar and jaxb-impl-2.2.4-1.jar from the war and tested. Still i am facing the same issue.

What is the reason? Thanks in advance.

Upvotes: 1

Views: 3303

Answers (1)

Sampada
Sampada

Reputation: 2991

Depending on the version of JBoss you are using, there would be a version of jaxb jars included with it. Check your JBOSS_HOME/modules/system/layers/base folder.

If you want JBoss to ignore the jars it has and use your applications' instead, you will need to explicitly tell it to do so. This can be done using custom modules:

  1. Create a folder inside JBOSS_HOME/modules/system/layers/base/<folder_name>/main/ and put your jars in it.
  2. Create a module.xml file in this folder and list down all the jar names as <resource-root> .
  3. Create a jboss-deployment-structure.xml file in your web project's WEB-INF directory and list this custom module here.

For more details, check this link: https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7

Upvotes: 1

Related Questions