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

落爺英雄遲暮 提交于 2019-12-14 03:47:15

问题


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)

回答1:


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




回答2:


LinkageError is JBoss is generally caused by your app packaging its own copies of certain libraries that JBoss considers restricted. These are usually things in the java.* and javax.* packages.

Try adding cxf-rt-frontend-jaxws and cxf-bundle-rs as dependencies and mark some exclusions -> jetty-server, gernomino-servlet.

Also check the beans.xml is expected to be under the classpath, instead of WEB-INF.



来源:https://stackoverflow.com/questions/17152274/java-lang-linkageerror-loader-constraint-violation-previously-initiated-loading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!