java.lang.LinkageError: loader constraint violatio

2020-04-27 21:29发布

I have developed a web service with authentication in java following the link Web Service Atuthentication The Same is runing fine if I am using JDK 1.6/JBoss 4.2 but when I deploy it in Jboss 5.1.0 GA I am getting deployment error. I google and found there is some jar conflict between JDK1.6,Jboss and my application. And replaced the JBoss/lib/endorsed jaxws-ri.jar with the latest jaxws-ri-2.2.8.jar. But I am not able to identify which jar is creating conflict now.

Below is my code of web.xml, sun-jaxws.xml and exception.

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>biservices</display-name>
<listener>
<listener-class>
        com.sun.xml.ws.transport.http.servlet.WSServletContextListener
    </listener-class>
</listener>
<servlet>
<servlet-name>BiServices</servlet-name>
 <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>BiServices</servlet-name>
<url-pattern>/biservices</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>120</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>


sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
<endpoint
   name="IBiUpdate"
   implementation="com.sbilife.ws.BiUpdate"
   url-pattern="/biservices"/>
</endpoints>

exception
java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "com.sun.xml.ws.util.xml.XMLStreamReaderFilter.getAttributeName(I)Ljavax/xml/namespace/QName;" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, com/sun/xml/ws/util/xml/XMLStreamReaderFilter, and the class loader (instance of <bootloader>) for interface javax/xml/stream/XMLStreamReader have different Class objects for the type javax/xml/namespace/QName used in the signature

Thanks Pise

1条回答
家丑人穷心不美
2楼-- · 2020-04-27 21:57

The exception is thrown because in your web application at least exists a jar which contains the javax.xml.namespace.QName class and that class conflicts with the same one contained in one of the JBoss's jar.

You should remove that (these) jar(s) from your web application when deploying on JBoss.

A list of jars which contain the javax.xml.namespace.QName class is at http://www.findjar.com/class/javax/xml/namespace/QName.html

查看更多
登录 后发表回答