You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Kishanthan Thangarajah (JIRA)" <ji...@apache.org> on 2013/04/29 07:54:16 UTC

[jira] [Commented] (AXIS2-5184) Code working with Axis 2 1.5.x throws exception with 1.6.1

    [ https://issues.apache.org/jira/browse/AXIS2-5184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13644291#comment-13644291 ] 

Kishanthan Thangarajah commented on AXIS2-5184:
-----------------------------------------------

This is same as AXIS2-5501. The cause/reason and workaround is explained in AXIS2-5501 itself.

If you want to use/pass configurationContext to the stub, you can either use ConfigurationContextFactory.createDefaultConfigurationContext() or ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null). For the first approach, you have to initialize the transportSenders. But for second approach, no such thing is needed.
                
> 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
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