[ 
http://issues.apache.org/jira/browse/AXIS2-764?page=comments#action_12414223 ] 

Deepal Jayasinghe commented on AXIS2-764:
-----------------------------------------

In the first place I didnt know that I had to use Async messageReceiver that is 
why I was not able to generate the issue. But after you comment I was able to 
re-generate the problem and found that it is a bug in axis2 and not easy to 
fix;that happen in following manner;
 -In the case of server side asynchronous once the message receiver get the 
message it will create a thread and add that to the thread pool
 -immediately after that java return will happen till transport receiver and it 
will check the message context whether response is written or not
- In this particular case that flag is false and transport receiver will write 
HTTP 200
- So the client side transport sender will be trigged and it will try to read 
the stream
 -But that dose not have anything (body is empty)
 - So you are getting that exception
 - And after that transport sender at the server side will send the actual 
response ,but at that point client has already thrown the exception.



The solution to this problem is to write client side in the asynchronous manner 
; as follows

       OMElement payload = createDummyOMElement("echoElementAll");
        Options options = new Options();
        options.setUseSeparateListener(true);
        options.setTo(targetEPR);
        options.setAction("urn:echoElementAll");
        options.setTransportInProtocol("http");
        ConfigurationContext configurationContextFromFileSystem =
                
ConfigurationContextFactory.createConfigurationContextFromFileSystem("myRepo 
location", null);
        ServiceClient sc = new 
ServiceClient(configurationContextFromFileSystem, null);
        sc.engageModule(new QName("addressing"));
        sc.setOptions(options);
        OMElement res = sc.sendReceive(payload);


> using sendreceive(blocking)  it throws a nullPointerException
> -------------------------------------------------------------
>
>          Key: AXIS2-764
>          URL: http://issues.apache.org/jira/browse/AXIS2-764
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: transports
>     Versions: 1.0
>  Environment: jdk 1.5.0_06
> tomcat 5.5.12
> axis2  1.0
>     Reporter: jacopo ravagnan
>     Assignee: Deepal Jayasinghe
>     Priority: Critical

>
> I've deployed a simple webservice with three methods.
> First one is echoElement method:
> public OMElement echoElementAll(OMElement element){
>               element.build();
>               element.detach();
>               return element;
>       }
> Second one is the same without build and detach, third one is one method that 
> makes a connection to database.
> Every time I'm trying to invoke one of these methods using my client with:
> OMElement ris=serviceClient.sendReceive(in);
> axis 2 throws this exception server-side:
> Exception in thread "Axis2 Task" java.lang.NullPointerException
>       at 
> org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:747)
>       at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
>       at 
> org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:305)
>       at 
> org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:990)
>       at org.apache.coyote.Response.action(Response.java:182)
>       at 
> org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:322)
>       at 
> org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:293)
>       at 
> org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:97)
>       at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:410)
>       at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152)
>       at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
>       at java.io.BufferedWriter.flush(BufferedWriter.java:236)
>       at 
> com.ctc.wstx.sw.BaseStreamWriter.flushStream(BaseStreamWriter.java:1430)
>       at 
> com.ctc.wstx.sw.BaseStreamWriter.safeFlushStream(BaseStreamWriter.java:1437)
>       at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
>       at 
> org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:119)
>       at 
> org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:382)
>       at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:256)
>       at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:210)
>       at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:589)
>       at 
> org.apache.axis2.receivers.AbstractInOutAsyncMessageReceiver$1.handleResult(AbstractInOutAsyncMessageReceiver.java:42)
>       at 
> org.apache.axis2.receivers.AbstractInOutAsyncMessageReceiver$2.run(AbstractInOutAsyncMessageReceiver.java:60)
>       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)
> and this Exception client-side:
> Exception in thread "main" org.apache.axis2.AxisFault: Incoming message input 
> stream is null
>       at 
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:64)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:349)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:279)
>       at 
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:457)
>       at 
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:399)
>       at it.ibc.axis2.test.ArtDaCodClient.main(ArtDaCodClient.java:71)
> I think it's a timeout-problem or a serialization-problem of message. Can you 
> fix it?
> Thank you.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to