微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

REST CXF Webservice 客户端调用服务端异常

Exception in thread "main" javax.ws.rs.client.ClientException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.cxf.staxutils.StaxUtils

at org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1125)

at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1088)

at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1038)

at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:858)

at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:832)

at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:395)

at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:574)

at ClientWS.main(ClientWS.java:17)

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.cxf.staxutils.StaxUtils

at org.apache.cxf.jaxrs.provider.JAXBElementProvider.readFrom(JAXBElementProvider.java:207)

at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1288)

at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:506)

at org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1104)

... 7 more



原因:

缺少jar包 stax2-api-3.1.1.jar,也许缺少其它jar也会有此问题


我的客户端调用服务端代码引入的jar包列表:


cxf-2.7.6.jar

geronimo-jaxws-2.2_spec-1.1.jar

javax.ws.rs-api-2.0-m10.jar

jaxb-api-2.2.6.jar

neethi-3.0.2.jar

stax2-api-3.1.1.jar

woodstox-core-asl-4.2.0.jar

wsdl4j-1.6.3.jar

xercesImpl-2.9.1.jar

xmlschema-core-2.0.jar

可能有些没有用到,但是至少有这些没有报错。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐