java.lang.LinkageError: loader constraint violation previously initiated loading for a different type with name "javax/xml/soap/SOAPMessage"

Joecep picture Joecep · Jun 17, 2013 · Viewed 10.4k times · Source

I'm new to webservices. I'm trying to call a service but I'm having the below error. Based on my initial google search seems this is a loader issue that can be caused by duplicate jars, but I cannot locate which one causes this. Any help is very much appreciated.

Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) previously initiated loading for a different type with name "javax/xml/soap/SOAPMessage"
    at org.apache.cxf.jaxws.support.JaxWsEndpointImpl.<init>(JaxWsEndpointImpl.java:126)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.createEndpoint(JaxWsServiceFactoryBean.java:208)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createEndpoints(ReflectionServiceFactoryBean.java:366)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:297)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:178)
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)
    at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51)
    at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:102)
    at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:115)
    at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:437)
    at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:316)
    at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:303)
    at javax.xml.ws.Service.getPort(Service.java:92)

Answer

Joecep picture Joecep · Jun 21, 2013

What solved my problem is the duplicate saaj.jar in my projects.