java.lang.LinkageError:javax.xml.xpath.XPath.setNamespaceContext的加载器约束违例

时间:2017-03-29 03:24:29

标签: java xml xpath jboss

import javax.xml.namespace.NamespaceContext;
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.setNamespaceContext(some code goes here)

我在我的网络应用中使用javax.xml.namespace.NamespaceContext,当部署在jboss服务器上时,它会发出以下错误:

javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.xml.xpath.XPath.setNamespaceContext(Ljavax/xml/namespace/NamespaceContext;)V" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, com/accenture/mdh/sso/util/Util, and the class loader (instance of <bootloader>) for resolved class, javax/xml/xpath/XPath, have different Class objects for the type )V used in the signature
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
    org.apache.jsp.jsp.LoginConsumer_jsp._jspService(LoginConsumer_jsp.java:187)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

我在互联网上搜索,似乎WEB-INF / lib中有javax.xml.namespace.NamespaceContext的冲突罐子。但是,我仍然无法找到原因。真的很感激你的想法。

1 个答案:

答案 0 :(得分:0)

排除以下具有相同包名javax.xml.namespace.NamespaceContext的库解决了问题。

  • stax-api.jar
  • javax.xml.stream_1.0.1.v201004272200.jar