开发CXF客户端的时候,会报一下错误:

本来以为是CXF的错误,到最后发现竟然是json的错误!

需要加入以下一个jar包:

问题解决

警告: Application{http://webservice.hxb.its.ct.siemens.com/}TopoServiceImplService#{http://webservice.hxb.its.ct.siemens.com/}getToPoInfohas thrown exception, unwinding now

org.apache.cxf.interceptor.Fault:net/sf/json/JSONArray

atorg.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)

atorg.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)

atorg.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)

atorg.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)

atorg.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:66)

atorg.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)

atorg.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)

atjava.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

atjava.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)

atjava.util.concurrent.FutureTask.run(Unknown Source)

atorg.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)

atorg.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)

atorg.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)

atorg.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

atorg.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:237)

atorg.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:214)

atorg.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:194)

atorg.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:130)

atorg.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:225)

atorg.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:145)

atjavax.servlet.http.HttpServlet.service(HttpServlet.java:637)

atorg.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:201)

atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)

atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)

atorg.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

atjava.lang.Thread.run(Unknown Source)

Caused by:java.lang.NoClassDefFoundError: net/sf/json/JSONArray

atcom.siemens.ct.its.hxb.server.ciinstance.service.external.impl.WSCIInstanceServiceImpl.getToPoInfo(WSCIInstanceServiceImpl.java:125)

atcom.siemens.ct.its.hxb.webservice.TopoServiceImpl.getToPoInfo(TopoServiceImpl.java:39)

atsun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

atsun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

atsun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

atjava.lang.reflect.Method.invoke(Unknown Source)

atorg.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

atorg.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)

... 31more