axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sagara Gunathunga (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (AXIS2-5501) Creating ServiceClient with ConfigContext created using createDefaultConfigurationContext() causes NullPointerException
Date Sat, 13 Jul 2013 07:49:50 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-5501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sagara Gunathunga  resolved AXIS2-5501.
---------------------------------------

    Resolution: Not A Problem
      Assignee: Kishanthan Thangarajah
    
> Creating ServiceClient with ConfigContext created using createDefaultConfigurationContext()
causes NullPointerException
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-5501
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5501
>             Project: Axis2
>          Issue Type: Bug
>          Components: transports
>    Affects Versions: 1.6.0, 1.6.1, 1.6.2
>         Environment: Any.  Testing on Windows 7 with java 1.5.
>            Reporter: Barry Tarlton
>            Assignee: Kishanthan Thangarajah
>            Priority: Critical
>              Labels: nullpointer, transport
>             Fix For: 1.5.6
>
>
> Something has changed from 1.5.6 to 1.6.0 in the axis2-transport-http.jar that causes
a null pointer exception if you initialize your ServiceClient with an ConfigurationContext
that was created by calling ConfigurationContextFactory.createDefaultConfigurationContext().
 
> Here's the modified sample that shows the behavior:
> public class EchoBlockingClient {
>     private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/checkSoap");
>     public static void main(String[] args) throws Exception {
>         try {
>             OMElement payload = ClientUtil.getEchoOMElement();
>             Options options = new Options();
>             options.setTo(targetEPR);
>             options.setAction("urn:echo");
>             // create config using defaultConfigurationContext... 
>             // this does not initialize the transportOutDescription's sender's transportOut
and causes a null pointer
>             ConfigurationContext defaultContext= ConfigurationContextFactory.createDefaultConfigurationContext();
>             
>             
>             // this initializes the transportOut.sender.transportOut properly and allows
it to work.
>             // ConfigurationContext defaultContext= ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,
null);
>             
>             
>             
>             //Blocking invocation
>             ServiceClient sender = new ServiceClient(defaultContext, null);
>             sender.setOptions(options);
>             OMElement result = sender.sendReceive(payload);
>             System.out.println(result);
>         } catch (AxisFault axisFault) {
>             axisFault.printStackTrace();
>         }
>     }
> I see the following exception when doing so:
> Exception in thread "main" java.lang.NullPointerException
> 	at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:172)
> 	at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
> This is because the TransportOutDescription is never set on the CommonHTTPTransportSender.
 
> If I change the code and use the
> ConfigurationContext defaultContext= ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,
null);
> Then this code works fine.
> I can also, just replace the axis2-transport-http-1.6.0.jar with the axis2-transport-http-1.5.6.jar
and it will work either way.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


Mime
View raw message