You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Deepal Jayasinghe (JIRA)" <ji...@apache.org> on 2006/09/13 08:24:23 UTC

[jira] Commented: (AXIS2-1094) Throw NullPointerException when invoking a service and return a customer JavaBean.

    [ http://issues.apache.org/jira/browse/AXIS2-1094?page=comments#action_12434367 ] 
            
Deepal Jayasinghe commented on AXIS2-1094:
------------------------------------------

I tested your sample in the current SVN and found that there is no problem in the server side , and you are getting the following response.

 <ns:echoResponse xmlns:ns="http://service.test/xsd">
            <ns:return>
               <birth xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
               <ns:name>Eric Chow...BACKED</ns:name>
            </ns:return>
         </ns:echoResponse>

And I think which is correct , but now I am getting an exception in the client side . That is because according to the wsdl , it does not say that you can not have null value in the response. So if you change your service impl class as following you wont be getting any exception.

 public User echo(User u) {
        System.out.println("Receive: " + u.getName());
        u.setBirth(Calendar.getInstance().getTime());
        u.setName(u.getName() + "...BACKED");

        return u;
    }


> Throw NullPointerException when invoking a service and return a customer JavaBean.
> ----------------------------------------------------------------------------------
>
>                 Key: AXIS2-1094
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1094
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: WinXP Pro. Java 5 (1.5.0_07), Axis2 (1.0)
>            Reporter: Eric Chow
>         Assigned To: Deepal Jayasinghe
>            Priority: Critical
>         Attachments: testservice.zip
>
>
> I tried to use Axis2-1.0 to create a simple echo web service that to return a simple Java bean. But was not success and throws NullPointerException. 
> I tried to return a String, it was very well without any error.
> All the codes were generated by Wsdl2Java. I tried to use ADB and Xmlbeans, but also failed. The following is the exception when I run the client in eClipse-3.2. The attachment is the sources,  AAR and WSDL, please check.
> log4j:WARN No appenders could be found for logger (org.apache.axiom.om.impl.builder.StAXOMBuilder).
> log4j:WARN Please initialize the log4j system properly.
> Testing1234...
> Exception in thread "main" org.apache.axis2.AxisFault: java.lang.NullPointerException
> 	at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:287)
> 	at test.gen.EchoserviceStub.echo(EchoserviceStub.java:244)
> 	at test.client.Client.main(Client.java:39)
> Caused by: java.lang.Exception: org.apache.axis2.AxisFault: java.lang.NullPointerException; nested exception is: 
> 	org.apache.axiom.om.OMException: java.lang.NullPointerException
> 	at org.apache.axis2.AxisFault.makeFault(AxisFault.java:318)
> 	at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:136)
> 	at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)
> 	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454)
> 	at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)
> 	at org.apache.axis2.transport.http.HTTPWorker.processRequest(HTTPWorker.java:255)
> 	at org.apache.axis2.transport.http.server.SimpleConnectionThread.run(SimpleConnectionThread.java:92)
> 	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> 	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> 	at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.axiom.om.OMException: java.lang.NullPointerException
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:206)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:298)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.detach(OMElementImpl.java:584)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:118)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:240)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:197)
> 	at org.apache.axis2.rpc.receivers.RPCUtil.processResponse(RPCUtil.java:71)
> 	at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:130)
> 	... 8 more
> Caused by: java.lang.NullPointerException
> 	at org.apache.axis2.databinding.utils.reader.WrappingXMLStreamReader.getEventType(WrappingXMLStreamReader.java:141)
> 	at org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.processProperties(ADBXMLStreamReaderImpl.java:964)
> 	at org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.next(ADBXMLStreamReaderImpl.java:807)
> 	at org.apache.axis2.util.StreamWrapper.next(StreamWrapper.java:68)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:123)
> 	... 15 more
> 	at org.apache.axis2.AxisFault.<init>(AxisFault.java:159)
> 	... 3 more

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org