2

客户端错误是:

    0 [main] INFO org.ws.call.BankWSCallClass - callChequeCertificationWS...
702 [main] INFO org.ws.call.BankWSCallClass - callChequeVerificationWS... serviceCreated
702 [main] INFO org.ws.call.BankWSCallClass - callChequeVerificationWS... portCreated
Exception in thread "main" org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method chequeCertification
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at org.ws.server.implementation.ChequeProcessingServiceStub.chequeCertification(ChequeProcessingServiceStub.java:911)
    at org.ws.call.BankWSCallClass.callChequeCertificationWS(BankWSCallClass.java:53)
    at org.ws.call.BankWSCallClass.main(BankWSCallClass.java:106)

虽然服务器端错误是

    [#|2012-05-10T15:52:32.390+0300|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=79;_ThreadName=Thread-2;|[ERROR] Exception occurred while trying to invoke service method chequeCertification
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
    at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
    at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
    at org.ws.server.implementation.ChequeProcessingService.chequeCertification(ChequeProcessingService.java:18)
    ... 37 more
|#]

概述:我使用springsourcetool(类似于eclipse)作为开发IDE。Glassfish 作为应用服务器。Web 服务是 ChequeProcessingService,我生成了 .aar 文件并将其部署在 glassfish 的axis2 Web 项目下。客户端代码是使用axis2代码生成器工具生成的,它只是调用具有javabean请求参数并返回另一个javabean响应对象的Web服务方法'chequeCertification'。

使用的 Axis2 版本是 1.6.2 和 JDK 1.7

请从哪里得到这个问题的建议。

4

1 回答 1

5

真正的问题是服务器中的这个 NullPointerException:

Caused by: java.lang.NullPointerException
    at org.ws.server.implementation.ChequeProcessingService.chequeCertification
       (ChequeProcessingService.java:18)

这可能在您编写的某些代码中,因此无法准确说出问题所在。

当服务器抛出异常时,客户端错误可能只是对服务器返回的错误响应的反应。您应该考虑添加一些逻辑来捕获调用 Web 服务时抛出的 AxisFaults,以便您可以打印更合适的错误消息。

于 2012-05-10T17:47:07.660 回答