我使用Java 11、Sping Boot 2.1.1和Apache CXF 3.2.7来公开一个导入XSD模式的SOAP Web服务。
<wsdl:import location="http://localhost:9000/endpoint/ws?wsdl=WS_endpointSoapPort.wsdl" namespace="http://test.com"> </wsdl:import>
当我发送一个查询时,它失败了,并显示以下堆栈:
2018-12-31 12:05:54,908 ERROR se.[Tomcat].[localhost].[/].[CXFServlet]: 175 - Servlet.service() for servlet [CXFServlet] in context with path [] threw exception [Servlet execution threw an exception] with root cause
java.lang.NoSuchMethodError: org.codehaus.stax2.ri.EmptyIterator.getInstance()Lorg/codehaus/stax2/ri/EmptyIterator;
有什么想法吗?
6条答案
按热度按时间yebdmbv41#
我在
org.apache.cxf:cxf-core
中的3.1.4版本和com.sun.xml.ws:rt
中的4.1版本中遇到了org.codehaus.woodstox:stax2-api
冲突。我通过使用Maven excludes删除库来解决冲突:qybjjes12#
经过深入研究,我发现下面的JIRA提到了Stax 2版本的问题。顺便说一句,票说,它解决了我正在使用的版本。
最后,我修复了升级到woodstox-core-5.2.0的问题。事实上,库中提到了一个类似的问题,在那个版本中已经解决了。详细信息here。
我当前的
mvn dependency:tree
是:qfe3c7zg3#
我遇到了同样的问题,升级到CXF 3.2.7或更高版本为我修复了这个问题。
gxwragnw4#
密钥可能在您的
mvn:dependency-tree
输出中。org.apache.cxf:cxf-rt-ws-security:jar:3.3.6
导致stax 2-API的版本3.1.4和版本4.2,因为非常过时的woodstox-core-asl
依赖项(从2014年开始)。我将不得不看看我是否可以摆脱这个,因为它导致上面描述的NoSuchMethodFoundError。ca1c2owp5#
这问题是在新版本的stax2-api新方法被添加.你能解决这问题通过添加新版本的stax2-api.在我的情况添加
解决了问题。
bwleehnv6#
我在Maven中的一些依赖项也遇到了同样的问题,这些依赖项使用了不同版本的stax 2-API。
Maven编译器只使用一个版本的stax 2-API(在我的例子中,它是最新的),所以我尝试使用runtime scope包含版本3.1.4和4.2.1(其他jar需要它们)
下面是pom.xml的一个片段
备注:在我的例子中,它在将类作为java应用程序执行时有效,但在web应用程序环境(Tomcat)中执行时无效!