Hi Ramidu
Can I know I you terminate your client operations? when searching issue
related to the stack you posted, it seems like the client handler shutdown
immediately but still there are some requests being processing.

based on the searching [1] reported similar issue and to avoid what we have
suggested [2]
[1]https://wso2.org/jira/browse/CARBON-10439
[2]https://wso2.org/jira/browse/ESBJAVA-2419


Cheers,
Dushan




https://wso2.org/jira/browse/CARBON-10439




On Tue, Mar 11, 2014 at 3:15 PM, Ramindu Deshapriya <[email protected]>wrote:

> Hi,
>
> I have written 50+ Integration Tests for the Google Drive Cloud Connector
> using a ServiceClient to send messages to the ESB. I use the following
> method to build the client:
>
> public static OperationClient buildMEPClient(EndpointReference endpoint,
> OMElement request) throws AxisFault {
>
>         ServiceClient serviceClient = new ServiceClient();
>
>         Options serviceOptions = new Options();
>         serviceOptions.setTo(endpoint);
>         serviceOptions.setAction("mediate");
>         serviceClient.setOptions(serviceOptions);
>         MessageContext messageContext = new MessageContext();
>
>         SOAPEnvelope soapEnvelope =
> TransportUtils.createSOAPEnvelope(request);
>         messageContext.setEnvelope(soapEnvelope);
>         OperationClient mepClient =
> serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
>         mepClient.addMessageContext(messageContext);
>         return mepClient;
>     }
>
> after which I call mepClient.execute(true) to receive a response in the
> following manner within each test:
>
> mepClient = ConnectorIntegrationUtil.buildMEPClient(new EndpointReference(
>                     getProxyServiceURL(CONNECTOR_NAME + "_" + methodName)),
> requestEnvelope);
>  mepClient.execute(true);
>             MessageContext responseMsgCtx =
> mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>
> However, when running this test suite, sometimes I receive random
> NullPointerExceptions on different methods. Note that I do not get this
> exception on the same test methods, rather I might get it on one or two
> random methods during a single test run or I might not get it at all. The
> stack trace for a typical occurrence is;
>
> java.lang.NullPointerException
>         at
>
> org.apache.axis2.context.AbstractContext.needPropertyDifferences(AbstractContext.java:239)
>         at
>
> org.apache.axis2.context.AbstractContext.setProperty(AbstractContext.java:202)
>         at
>
> org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:270)
>         at
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
>         at
> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
>         at
>
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:451)
>         at
>
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:278)
>         at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
>         at
>
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:398)
>         at
>
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:224)
>         at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
>         at
>
> org.wso2.carbon.connector.integration.test.googledrive.GoogledriveConnectorIntegrationTest.testgetCommentByIDOptionalParams(GoogledriveConnectorIntegrationTest.java:1316)
>
> In these instances, I have noticed that the correct response is returned by
> the backend API via monitoring the wire log, however, the test will simply
> fail giving the above stack trace.
>
> Is there any way to overcome this issue?
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Getting-random-NullPointerException-on-Operation-Client-during-Connector-Integration-Tests-tp93294.html
> Sent from the WSO2 Development mailing list archive at Nabble.com.
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>



-- 
Dushan Abeyruwan | Associate Tech Lead
Integration Technologies Team
PMC Member Apache Synpase
WSO2 Inc. http://wso2.com/
Blog:http://dushansview.blogspot.com/
Mobile:(0094)713942042
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to