Exception in thread "main" javax.ws.rs.client.ClientException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.cxf.staxutils.StaxUtilsjava at org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1125)apache at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1088)api at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1038)ide at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:858)spa at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:832)orm at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:395)xml at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:574)get at ClientWS.main(ClientWS.java:17)it Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.cxf.staxutils.StaxUtilsio 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
可能有些沒有用到,可是至少有這些沒有報錯。