Code working with Axis 2 1.5.x throws exception with 1.6.1
----------------------------------------------------------

                 Key: AXIS2-5184
                 URL: https://issues.apache.org/jira/browse/AXIS2-5184
             Project: Axis2
          Issue Type: Bug
          Components: client-api
    Affects Versions: 1.6.1
         Environment: Windows / Solaris
            Reporter: Dmitriy


The following code is working when using JRE 5 with Axis2 1.5.1 and 1.5.6:

        public static void test() throws Exception {
                ConfigurationContext ctx = 
ConfigurationContextFactory.createDefaultConfigurationContext();
                String svcAddrress = 
"http://localhost:8080/axis2/services/era_aas";;
                Era_aasStub  stub = new Era_aasStub(ctx,svcAddrress);
                Era_aasStub.UserIdentityIn in = new 
Era_aasStub.UserIdentityIn();

                in.setCallerId("DMITRIY");
                // more fields are set here, all are Strings

                Era_aasStub.UserProfile out = stub.loginUi(in);
        }

When I switch to JRE 6 using Axis 1.6.1 the code throws the following exception:

java.lang.NullPointerException
        at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:172)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
        at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
        at 
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
        at 
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
        at gov.nih.era.aas.client.auto.Era_aasStub.loginUi(Era_aasStub.java:498)
        at AasServiceTest.test(AasServiceTest.java:93)
        at AasServiceTest.main(AasServiceTest.java:53)

The workaround I have found is to change the code as following (do not pass 
context to the stub constructor):

        public static void test() throws Exception {
                ConfigurationContext ctx = 
ConfigurationContextFactory.createDefaultConfigurationContext();
                String svcAddrress = 
"http://localhost:8080/axis2/services/era_aas";;
                Era_aasStub  stub = new Era_aasStub(svcAddrress); // <-- this 
is the only change I had to make
                Era_aasStub.UserIdentityIn in = new 
Era_aasStub.UserIdentityIn();

                in.setCallerId("DMITRIY");
                // more fields are set here, all are Strings

                Era_aasStub.UserProfile out = stub.loginUi(in);
        }

However, this solution requires multiple code changes and also causes problems 
when we do need to pass context to the stub.  Please advise if there is a 
proper way to make the code work using 
ConfigurationContextFactory.createDefaultConfigurationContext().  Additional 
details:

No custom configuration - I am using standard binary distribution of Axis 2 
version 1.6.1.  The service code is generated from WSDL using ADB data binding.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.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