java.lang.LinkageError: 加载器约束冲突之前启动了名称为“javax/xml/soap/SOAPMessage”的不同类型的加载
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17152274/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.LinkageError: loader constraint violation previously initiated loading for a different type with name "javax/xml/soap/SOAPMessage"
提问by Joecep
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.
我是网络服务的新手。我正在尝试调用服务,但出现以下错误。根据我最初的谷歌搜索,这似乎是一个加载器问题,可能是由重复的 jars 引起的,但我无法找到是哪个导致了这个问题。很感谢任何形式的帮助。
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)
回答by Joecep
What solved my problem is the duplicate saaj.jar in my projects.
解决我的问题的是我的项目中重复的 saaj.jar。
回答by umangm
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.
LinkageError 是 JBoss 通常是由您的应用程序打包 JBoss 认为受限的某些库的自己的副本引起的。这些通常在 java.* 和 javax.* 包中。
Try adding cxf-rt-frontend-jaxws and cxf-bundle-rs as dependencies and mark some exclusions -> jetty-server, gernomino-servlet.
尝试添加 cxf-rt-frontend-jaxws 和 cxf-bundle-rs 作为依赖项并标记一些排除项 -> jetty-server, gernomino-servlet。
Also check the beans.xml is expected to be under the classpath, instead of WEB-INF.
还要检查 beans.xml 是否应该在 classpath 下,而不是 WEB-INF。