Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5501

Creating ServiceClient with ConfigContext created using createDefaultConfigurationContext() causes NullPointerException

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Not A Problem
    • 1.6.0, 1.6.1, 1.6.2
    • 1.5.6
    • transports
    • Any. Testing on Windows 7 with java 1.5.

    Description

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            kishanthan Kishanthan Thangarajah
            javaplus Barry Tarlton
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment