【问题标题】:java.lang.LinkageError: loader constraint violation for javax.xml.xpath.XPath.setNamespaceContextjava.lang.LinkageError:javax.xml.xpath.XPath.setNamespaceContext 的加载程序约束冲突
【发布时间】:2017-03-29 03:24:29
【问题描述】:
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 冲突的 jar。但是,我仍然无法找到原因。非常感谢您的想法。

【问题讨论】:

  • 你有这些罐子里的一两个吗?
  • 有一个未使用的 jar “javax.xml.stream_1.0.1.v201004272200.jar”,它具有相同的命名空间。即使删除它,我仍然得到同样的错误

标签: java xml xpath jboss


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-11
    • 2018-04-04
    • 2021-08-04
    • 2014-08-16
    • 1970-01-01
    • 2011-08-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多