on 01-05-2005 11:08 AM
Hi,
I have J2EE Enterprise Application containing an EJB module and an webmodule.
EJB module has one Stateless Session Bean.
Web Module has one Servlet (try to invoke the Stateless Session Bean.)
I have made the JNDI look up in the following way:
****************
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
env.put(Context.PROVIDER_URL, "localhost:50004");
Context cxt =new InitialContext(env);
Object obj = cxt.lookup("Sample2/ReadConfigBean");
com.sap.rp.config.ReadConfigHome beanHome =(com.sap.rp.config.ReadConfigHome)javax.rmi.PortableRemoteObject.narrow( obj,com.sap.rp.config.ReadConfigHome.class);
****************
But at the part of PortableRemoteObject.narrow it is retruning me the beanHome as NULL.
And also I observed that the "cxt.lookup(s);" is returning and object of type class com.sap.engine.services.jndi.persistent.UnsatisfiedReferenceImpl.
Could any one put light on this. why it is happening like this.
I have verified the JNDI look up string.
Thanks for your time and help.
Regards
Ravi prasad
Hi Ravi,
the returned UnsatisfiedReferenceImpl merely indicates that the lookup object cannot be found.
As we had a personal mail correspondence I copy my explanation here to reveal it to the rest. Here it is:
The problem I see in the listed code is the way you obtain the InitialContext. According to the specification your servlet obtains its JNDI environment by Context cxt =new InitialContext();
A problem might also be a missing ejb-ref declaration in the web.xml. You have to declare an ejb-ref in order to lookup an EJB
A hint: You might list the whole naming tree using the lsn shell command (first you must activate it by add naming).
Regards,
Svetoslav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
Looks like you are using an incorrect JNDI lookup path that's why it couldn't return the object. You can check the JNDI lookup path of your EJB from the Visual Admin. Go to the EJB Container service and drill down to your EJB for the JNDI name. You should lookup using this path instead.
BTW, since your Web module and EJB module are in the same application, you can just lookup the EJB from your Servlet without providing the context, just a FYI.
Regards,
Marc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.