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 "Ali Sadik Kumlali (JIRA)" <ji...@apache.org> on 2006/05/06 00:03:28 UTC

[jira] Created: (AXIS2-679) Calling a service from within another service causes NPE

Calling a service from within another service causes NPE
--------------------------------------------------------

         Key: AXIS2-679
         URL: http://issues.apache.org/jira/browse/AXIS2-679
     Project: Apache Axis 2.0 (Axis2)
        Type: Bug

  Components: core  
    Versions: 1.0    
 Environment: WinXP Pro, JDK 1.4, Tomcat 5.5
    Reporter: Ali Sadik Kumlali


Here is my scenario:
1) I have serviceA.wsdl and serviceB.wsdl. 
2) I generate skeletons and stubs with WSDL2Java
3) I have serviceA.aar which has serviceB.wsdl's stub
4) When I call serviceB's stub from a class found in serviceA.aar I get the following error:

----------------------------------------------------------------
java.lang.NullPointerException
	at org.apache.axis2.context.ServiceGroupContext.getServiceContext(ServiceGroupContext.java:59)
	at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:101)
	at com.mycompany.service.test.account.AccountServicesStub.<init>(AccountServicesStub.java:79)
----------------------------------------------------------------

I founded that "unassinged parent" caused the NPE. If the service is already registered in axisConfig it doesn't enter in the code that assings a parent to the service. Also, it doesn't uses the parent of the registered service.

The code causes NPE is here:
----------------------------------------------------------------
// org.apache.axis2.client.ServiceClient
public ServiceClient(ConfigurationContext configContext,
                     AxisService axisService) throws AxisFault {

  ...
  // If the service is already registered, it doesn't enter
  // here so there will be no parent.
  if (this.axisConfig.getService(this.axisService.getName()) == null) {
    this.axisConfig.addService(this.axisService);
  }
  ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
                (AxisServiceGroup) this.axisService.getParent());
  this.serviceContext = sgc.getServiceContext(this.axisService);
}
----------------------------------------------------------------

I made the following change and it worked:

----------------------------------------------------------------
// org.apache.axis2.client.ServiceClient
public ServiceClient(ConfigurationContext configContext,
                     AxisService axisService) throws AxisFault {
  ...
  AxisService service = null;
  AxisService registeredService = 
    this.axisConfig.getService(this.axisService.getName());
  if (registeredService != null) {
    service = registeredService;
  } else {
    this.axisConfig.addService(this.axisService);
    service = this.axisService;
  }
    
  ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
            (AxisServiceGroup) service.getParent());  
  this.serviceContext = sgc.getServiceContext(service);
}
----------------------------------------------------------------

But  this time, there was no addressing and security headers in the soap message. Then I tried to manually engage the modules as following:

----------------------------------------------------------------
stubB._getServiceClient().engageModule(new QName("addressing"));
stubB._getServiceClient().engageModule(new QName("rampart"));
----------------------------------------------------------------

It didn't work either.

P.S.: I tried both 1.0 RC5 and 1.0 releases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS2-679) Calling a service from within another service causes NPE

Posted by "Ali Sadik Kumlali (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-679?page=comments#action_12378305 ] 

Ali Sadik Kumlali commented on AXIS2-679:
-----------------------------------------

Oops! Second call has problem in either case.

Here is the scenario again:
-----------------------------------------------

- When I call serviceA, one of its methods calls stub of serviceB.

Here is the last minute situations:
-----------------------------------------------
- With the ServiceClient comming with 1.0 release:
  - First call to serviceA works well.
  - Second call causes the mentioned NPE at the server side which serviceA is deployed.

- When modify the ServiceClient of 1.0 release;
  - First call to serviceA works well
  - Second call causes "org.apache.axis2.AxisFault: WSDoAllReceiver: Request does not contain required Security header" at the client side which serviceB.aar is deployed. At the server, there is no NPE. The SOAP has WS-Addressing tags, but not WS-Security tags.

> Calling a service from within another service causes NPE
> --------------------------------------------------------
>
>          Key: AXIS2-679
>          URL: http://issues.apache.org/jira/browse/AXIS2-679
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: core
>     Versions: 1.0
>  Environment: WinXP Pro, JDK 1.4, Tomcat 5.5
>     Reporter: Ali Sadik Kumlali
>     Assignee: Deepal Jayasinghe

>
> Here is my scenario:
> 1) I have serviceA.wsdl and serviceB.wsdl. 
> 2) I generate skeletons and stubs with WSDL2Java
> 3) I have serviceA.aar which has serviceB.wsdl's stub
> 4) When I call serviceB's stub from a class found in serviceA.aar I get the following error:
> ----------------------------------------------------------------
> java.lang.NullPointerException
> 	at org.apache.axis2.context.ServiceGroupContext.getServiceContext(ServiceGroupContext.java:59)
> 	at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:101)
> 	at com.mycompany.service.test.account.AccountServicesStub.<init>(AccountServicesStub.java:79)
> ----------------------------------------------------------------
> I founded that "unassinged parent" caused the NPE. If the service is already registered in axisConfig it doesn't enter in the code that assings a parent to the service. Also, it doesn't uses the parent of the registered service.
> The code causes NPE is here:
> ----------------------------------------------------------------
> // org.apache.axis2.client.ServiceClient
> public ServiceClient(ConfigurationContext configContext,
>                      AxisService axisService) throws AxisFault {
>   ...
>   // If the service is already registered, it doesn't enter
>   // here so there will be no parent.
>   if (this.axisConfig.getService(this.axisService.getName()) == null) {
>     this.axisConfig.addService(this.axisService);
>   }
>   ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
>                 (AxisServiceGroup) this.axisService.getParent());
>   this.serviceContext = sgc.getServiceContext(this.axisService);
> }
> ----------------------------------------------------------------
> I made the following change and it worked:
> ----------------------------------------------------------------
> // org.apache.axis2.client.ServiceClient
> public ServiceClient(ConfigurationContext configContext,
>                      AxisService axisService) throws AxisFault {
>   ...
>   AxisService service = null;
>   AxisService registeredService = 
>     this.axisConfig.getService(this.axisService.getName());
>   if (registeredService != null) {
>     service = registeredService;
>   } else {
>     this.axisConfig.addService(this.axisService);
>     service = this.axisService;
>   }
>     
>   ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
>             (AxisServiceGroup) service.getParent());  
>   this.serviceContext = sgc.getServiceContext(service);
> }
> ----------------------------------------------------------------
> But  this time, there was no addressing and security headers in the soap message. Then I tried to manually engage the modules as following:
> ----------------------------------------------------------------
> stubB._getServiceClient().engageModule(new QName("addressing"));
> stubB._getServiceClient().engageModule(new QName("rampart"));
> ----------------------------------------------------------------
> It didn't work either.
> P.S.: I tried both 1.0 RC5 and 1.0 releases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (AXIS2-679) Calling a service from within another service causes NPE

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-679?page=all ]
     
Deepal Jayasinghe resolved AXIS2-679:
-------------------------------------

    Resolution: Fixed

fixed in current svn

> Calling a service from within another service causes NPE
> --------------------------------------------------------
>
>          Key: AXIS2-679
>          URL: http://issues.apache.org/jira/browse/AXIS2-679
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: core
>     Versions: 1.0
>  Environment: WinXP Pro, JDK 1.4, Tomcat 5.5
>     Reporter: Ali Sadik Kumlali
>     Assignee: Deepal Jayasinghe

>
> Here is my scenario:
> 1) I have serviceA.wsdl and serviceB.wsdl. 
> 2) I generate skeletons and stubs with WSDL2Java
> 3) I have serviceA.aar which has serviceB.wsdl's stub
> 4) When I call serviceB's stub from a class found in serviceA.aar I get the following error:
> ----------------------------------------------------------------
> java.lang.NullPointerException
> 	at org.apache.axis2.context.ServiceGroupContext.getServiceContext(ServiceGroupContext.java:59)
> 	at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:101)
> 	at com.mycompany.service.test.account.AccountServicesStub.<init>(AccountServicesStub.java:79)
> ----------------------------------------------------------------
> I founded that "unassinged parent" caused the NPE. If the service is already registered in axisConfig it doesn't enter in the code that assings a parent to the service. Also, it doesn't uses the parent of the registered service.
> The code causes NPE is here:
> ----------------------------------------------------------------
> // org.apache.axis2.client.ServiceClient
> public ServiceClient(ConfigurationContext configContext,
>                      AxisService axisService) throws AxisFault {
>   ...
>   // If the service is already registered, it doesn't enter
>   // here so there will be no parent.
>   if (this.axisConfig.getService(this.axisService.getName()) == null) {
>     this.axisConfig.addService(this.axisService);
>   }
>   ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
>                 (AxisServiceGroup) this.axisService.getParent());
>   this.serviceContext = sgc.getServiceContext(this.axisService);
> }
> ----------------------------------------------------------------
> I made the following change and it worked:
> ----------------------------------------------------------------
> // org.apache.axis2.client.ServiceClient
> public ServiceClient(ConfigurationContext configContext,
>                      AxisService axisService) throws AxisFault {
>   ...
>   AxisService service = null;
>   AxisService registeredService = 
>     this.axisConfig.getService(this.axisService.getName());
>   if (registeredService != null) {
>     service = registeredService;
>   } else {
>     this.axisConfig.addService(this.axisService);
>     service = this.axisService;
>   }
>     
>   ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
>             (AxisServiceGroup) service.getParent());  
>   this.serviceContext = sgc.getServiceContext(service);
> }
> ----------------------------------------------------------------
> But  this time, there was no addressing and security headers in the soap message. Then I tried to manually engage the modules as following:
> ----------------------------------------------------------------
> stubB._getServiceClient().engageModule(new QName("addressing"));
> stubB._getServiceClient().engageModule(new QName("rampart"));
> ----------------------------------------------------------------
> It didn't work either.
> P.S.: I tried both 1.0 RC5 and 1.0 releases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (AXIS2-679) Calling a service from within another service causes NPE

Posted by "Ali Sadik Kumlali (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-679?page=comments#action_12378303 ] 

Ali Sadik Kumlali commented on AXIS2-679:
-----------------------------------------

After some more work, I've come to cancel my both assertions which say "NPE" and "there is no WSA and WSSE headers".

I've noticed that;
- I called stub of serviceA, not serviceB
- I didn't add InflowSecurity and OutflowSecurity parameters to the axis2.xml of axis2.war.

By the way, I've just seen a strange situation. After I start the Tomcat which my serviceA.aar is deployed I list the services on it by calling http://localhost:8080/axis2/services/listServices. Only services I see there belong to serviceA.aar. But, after the first call to serviceB's stub within a class found in serviceA, serviceB is also listed in the page. The page says "Service Description : null" for the service. When clicked on it, it says "Unable to generate WSDL for this service". 

> Calling a service from within another service causes NPE
> --------------------------------------------------------
>
>          Key: AXIS2-679
>          URL: http://issues.apache.org/jira/browse/AXIS2-679
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: core
>     Versions: 1.0
>  Environment: WinXP Pro, JDK 1.4, Tomcat 5.5
>     Reporter: Ali Sadik Kumlali
>     Assignee: Deepal Jayasinghe

>
> Here is my scenario:
> 1) I have serviceA.wsdl and serviceB.wsdl. 
> 2) I generate skeletons and stubs with WSDL2Java
> 3) I have serviceA.aar which has serviceB.wsdl's stub
> 4) When I call serviceB's stub from a class found in serviceA.aar I get the following error:
> ----------------------------------------------------------------
> java.lang.NullPointerException
> 	at org.apache.axis2.context.ServiceGroupContext.getServiceContext(ServiceGroupContext.java:59)
> 	at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:101)
> 	at com.mycompany.service.test.account.AccountServicesStub.<init>(AccountServicesStub.java:79)
> ----------------------------------------------------------------
> I founded that "unassinged parent" caused the NPE. If the service is already registered in axisConfig it doesn't enter in the code that assings a parent to the service. Also, it doesn't uses the parent of the registered service.
> The code causes NPE is here:
> ----------------------------------------------------------------
> // org.apache.axis2.client.ServiceClient
> public ServiceClient(ConfigurationContext configContext,
>                      AxisService axisService) throws AxisFault {
>   ...
>   // If the service is already registered, it doesn't enter
>   // here so there will be no parent.
>   if (this.axisConfig.getService(this.axisService.getName()) == null) {
>     this.axisConfig.addService(this.axisService);
>   }
>   ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
>                 (AxisServiceGroup) this.axisService.getParent());
>   this.serviceContext = sgc.getServiceContext(this.axisService);
> }
> ----------------------------------------------------------------
> I made the following change and it worked:
> ----------------------------------------------------------------
> // org.apache.axis2.client.ServiceClient
> public ServiceClient(ConfigurationContext configContext,
>                      AxisService axisService) throws AxisFault {
>   ...
>   AxisService service = null;
>   AxisService registeredService = 
>     this.axisConfig.getService(this.axisService.getName());
>   if (registeredService != null) {
>     service = registeredService;
>   } else {
>     this.axisConfig.addService(this.axisService);
>     service = this.axisService;
>   }
>     
>   ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
>             (AxisServiceGroup) service.getParent());  
>   this.serviceContext = sgc.getServiceContext(service);
> }
> ----------------------------------------------------------------
> But  this time, there was no addressing and security headers in the soap message. Then I tried to manually engage the modules as following:
> ----------------------------------------------------------------
> stubB._getServiceClient().engageModule(new QName("addressing"));
> stubB._getServiceClient().engageModule(new QName("rampart"));
> ----------------------------------------------------------------
> It didn't work either.
> P.S.: I tried both 1.0 RC5 and 1.0 releases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (AXIS2-679) Calling a service from within another service causes NPE

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-679?page=all ]

Deepal Jayasinghe reassigned AXIS2-679:
---------------------------------------

    Assign To: Deepal Jayasinghe

> Calling a service from within another service causes NPE
> --------------------------------------------------------
>
>          Key: AXIS2-679
>          URL: http://issues.apache.org/jira/browse/AXIS2-679
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: core
>     Versions: 1.0
>  Environment: WinXP Pro, JDK 1.4, Tomcat 5.5
>     Reporter: Ali Sadik Kumlali
>     Assignee: Deepal Jayasinghe

>
> Here is my scenario:
> 1) I have serviceA.wsdl and serviceB.wsdl. 
> 2) I generate skeletons and stubs with WSDL2Java
> 3) I have serviceA.aar which has serviceB.wsdl's stub
> 4) When I call serviceB's stub from a class found in serviceA.aar I get the following error:
> ----------------------------------------------------------------
> java.lang.NullPointerException
> 	at org.apache.axis2.context.ServiceGroupContext.getServiceContext(ServiceGroupContext.java:59)
> 	at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:101)
> 	at com.mycompany.service.test.account.AccountServicesStub.<init>(AccountServicesStub.java:79)
> ----------------------------------------------------------------
> I founded that "unassinged parent" caused the NPE. If the service is already registered in axisConfig it doesn't enter in the code that assings a parent to the service. Also, it doesn't uses the parent of the registered service.
> The code causes NPE is here:
> ----------------------------------------------------------------
> // org.apache.axis2.client.ServiceClient
> public ServiceClient(ConfigurationContext configContext,
>                      AxisService axisService) throws AxisFault {
>   ...
>   // If the service is already registered, it doesn't enter
>   // here so there will be no parent.
>   if (this.axisConfig.getService(this.axisService.getName()) == null) {
>     this.axisConfig.addService(this.axisService);
>   }
>   ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
>                 (AxisServiceGroup) this.axisService.getParent());
>   this.serviceContext = sgc.getServiceContext(this.axisService);
> }
> ----------------------------------------------------------------
> I made the following change and it worked:
> ----------------------------------------------------------------
> // org.apache.axis2.client.ServiceClient
> public ServiceClient(ConfigurationContext configContext,
>                      AxisService axisService) throws AxisFault {
>   ...
>   AxisService service = null;
>   AxisService registeredService = 
>     this.axisConfig.getService(this.axisService.getName());
>   if (registeredService != null) {
>     service = registeredService;
>   } else {
>     this.axisConfig.addService(this.axisService);
>     service = this.axisService;
>   }
>     
>   ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
>             (AxisServiceGroup) service.getParent());  
>   this.serviceContext = sgc.getServiceContext(service);
> }
> ----------------------------------------------------------------
> But  this time, there was no addressing and security headers in the soap message. Then I tried to manually engage the modules as following:
> ----------------------------------------------------------------
> stubB._getServiceClient().engageModule(new QName("addressing"));
> stubB._getServiceClient().engageModule(new QName("rampart"));
> ----------------------------------------------------------------
> It didn't work either.
> P.S.: I tried both 1.0 RC5 and 1.0 releases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira