cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to access serviceRegistry in webscript bean class

romschn
Star Collaborator
Star Collaborator
Hi,

I have done the required configurations related to webscript.

See below code snippets for each of the required files :
context file :
<bean id="webscript.com.test.deployment.get" class="com.test.Deployment" parent="webscript">
    <property name="serviceRegistry" ref="ServiceRegistry"/>
</bean>

Java class for the Bean -
Deployment.java extends AbstractWebScript

When it tries to do this.serviceRegistry.getNodeService(), in the execute method, it gives NPE.

I am not sure why it is giving it.Any help would be highly appreciated.

Ramesh
3 REPLIES 3

patil
Champ on-the-rise
Champ on-the-rise
Hi ,

   <!– This bean is used for getting the nodeRef for the passed location with respect to company Home –>

   <bean id="webscript.com.patil.common.getNodeRefForLocation.get" class="com.patil.webscript.GetNodeRefForLocation"
      parent="webscript">
      <property name="serviceRegistry">
         <ref bean="ServiceRegistry" />
      </property>
   </bean>
Inside your GetNodeRefForLocation class you should have setter and getter method for serviceRegistry.
Then you will be able to access ServiceRegistry and get any services.

Make sure you have put the description file in the proper location.
In the webscript you can extend either AbstractWebScript or DeclarativeWebScript.


Thanks,
Patil
Cignex Technologies
Bangalore

patil
Champ on-the-rise
Champ on-the-rise
Hi,

<property name="serviceRegistry" ref="ServiceRegistry"/>
has to be replaced with

<property name="serviceRegistry">
<ref bean="ServiceRegistry" />

And in the bean setter and getter is required for serviceRegistry.


Thanks,
Patil
Cignex Technologies
Bangalore

romschn
Star Collaborator
Star Collaborator
Thanks Patil…The configurations were all set correctly only.

There was one silly mistake I had made while calling my method which was in turn accessing the serviceregistry…

It is corrected now…

Thank you…

Ramesh