gpt4 book ai didi

java - JAXB Soap 服务运行时错误(未找到 XPath 方法)

转载 作者:太空宇宙 更新时间:2023-11-04 08:23:25 26 4
gpt4 key购买 nike

我正在创建一个基于 SOAP 的 Web 服务,使用 JAXB 和 Spring 框架将它们组合在一起。我正在使用 spring 的 Web 服务动态生成 wsdl 文件,但是当我尝试访问它时,出现以下错误:

java.lang.NoSuchMethodError: org.apache.xpath.XPathContext.<init>(Z)V
at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:115)
at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99)
at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:184)
at org.springframework.xml.xpath.Jaxp13XPathExpressionFactory$Jaxp13XPathExpression.evaluate(Jaxp13XPathExpressionFactory.java:114)
at org.springframework.xml.xpath.Jaxp13XPathExpressionFactory$Jaxp13XPathExpression.evaluateAsNodeList(Jaxp13XPathExpressionFactory.java:106)
at org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter.transformLocations(WsdlDefinitionHandlerAdapter.java:200)
at org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter.handle(WsdlDefinitionHandlerAdapter.java:128)
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:213)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

现在首先,我以前从未在 NoSuchMethodError 末尾见过 (Z)V,所以我不确定这意味着什么,但我在这里也得到了非常有限的堆栈跟踪。我也不明白同一项目中的类如何调用不存在的方法。如果有人对我应该从哪里开始解决这个问题有一些想法,那就太好了。当然可以根据要求提供更多信息。

编辑:

因此,使用 mvn depedency:tree 命令查看是否存在具有不同 xpath 版本的多个 jar,我得到以下输出:

--- maven-dependency-plugin:2.1:tree (default-cli) @ LicensingSOAPService ---
[INFO] com.cepstral.licensing:LicensingSOAPService:war:0.1
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.3:runtime
[INFO] | \- javax.xml.soap:saaj-api:jar:1.3:runtime
[INFO] +- org.springframework.ws:spring-ws-core:jar:2.0.3.RELEASE:compile
[INFO] | +- org.springframework.ws:spring-xml:jar:2.0.3.RELEASE:compile
[INFO] | +- wsdl4j:wsdl4j:jar:1.6.1:compile
[INFO] | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework.ws:spring-ws-security:jar:2.0.3.RELEASE:runtime
[INFO] | +- com.sun.xml.wsit:xws-security:jar:1.3.1:runtime
[INFO] | +- com.sun.xml.wsit:wsit-rt:jar:1.1:runtime
[INFO] | \- org.apache.ws.security:wss4j:jar:1.5.8:runtime
[INFO] | \- org.apache.santuario:xmlsec:jar:1.4.3:runtime
[INFO] +- javax.xml.bind:jaxb-api:jar:2.0:compile
[INFO] | +- javax.xml.bind:jsr173_api:jar:1.0:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.0.3:compile
[INFO] +- org.springframework:spring-context:jar:3.1.0.RELEASE:compile
[INFO] | +- org.springframework:spring-core:jar:3.1.0.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:3.1.0.RELEASE:compile
[INFO] | \- org.springframework:spring-asm:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:3.1.0.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-web:jar:3.1.0.RELEASE:compile
[INFO] +- org.jdom:jdom:jar:1.1.2:compile
[INFO] | \- jaxen:jaxen:jar:1.1.3:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- jdom:jdom:jar:1.0:compile
[INFO] | +- xml-apis:xml-apis:jar:1.3.02:compile
[INFO] | +- xerces:xercesImpl:jar:2.6.2:compile
[INFO] | \- xom:xom:jar:1.0:compile
[INFO] | +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] | +- xalan:xalan:jar:2.7.1:compile
[INFO] | \- com.ibm.icu:icu4j:jar:2.6.1:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.1.0.RELEASE:compile
[INFO] | \- org.springframework:spring-context-support:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.1.0.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:3.0.6.RELEASE:compile
[INFO] +- org.springframework:spring-oxm:jar:3.1.0.RELEASE:compile
[INFO] | \- commons-lang:commons-lang:jar:2.5:compile
[INFO] +- org.springframework.security:spring-security-core:jar:3.1.0.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-crypto:jar:3.1.0.RELEASE:compile
[INFO] \- commons-dbcp:commons-dbcp:jar:1.4:compile
[INFO] \- commons-pool:commons-pool:jar:1.5.4:compile

我没有看到任何可疑的东西,所以我不确定还能去哪里。我正在继续尝试使用 glassfish 的 -verbose 选项来跟踪错误。谢谢大家。

编辑 2:因此在 glassfish 日志中显示以下内容:

[Loaded org.springframework.web.context.request.AbstractRequestAttributes from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar]
[Loaded org.springframework.web.context.request.ServletRequestAttributes from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar]
[Loaded org.apache.xml.dtm.DTMManager from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/xalan-2.6.0.jar]
[Loaded org.apache.xpath.XPathContext from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/xalan-2.6.0.jar]
[Loaded org.apache.xml.dtm.ObjectFactory$ConfigurationError from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/xalan-2.6.0.jar]
[Loaded org.apache.xml.dtm.DTMException from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/xalan-2.6.0.jar]
[Loaded org.apache.xml.dtm.DTMConfigurationException from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/xalan-2.6.0.jar]
[Loaded org.apache.xml.dtm.DTM from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/xalan-2.6.0.jar]
[Loaded org.apache.xalan.extensions.ExpressionContext from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/xalan-2.6.0.jar]
[Loaded org.apache.xml.utils.ObjectStack from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/xalan-2.6.0.jar]
[Loaded org.apache.xml.utils.IntVector from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/xalan-2.6.0.jar]
[Loaded org.apache.xml.utils.IntStack from file:/C:/glassfish/glassfish/domains/domain1/applications/licensingSoap/WEB-INF/lib/xalan-2.6.0.jar]

这肯定表明 xalan-2.6.0 jar 正在加载,但是当我查看 maven 项目的 target\licensingSoap 文件夹时,只有 xalan-2.7.1 jar,我假设这是我想要的。我不知道这个 jar 是如何在 glassfish 上运行时出现的。有什么想法吗?

最佳答案

您可能会从某个地方获取错误版本的类文件。使用 -verbose:class 重新运行以查看所有这些类是从哪里加载的。如果您需要帮助解释结果,请在此处发布结果(如果可以的话 - 不知道允许的尺寸是多少!)。

HTH,

大卫

关于java - JAXB Soap 服务运行时错误(未找到 XPath 方法),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9081283/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com