cancel
Showing results for 
Search instead for 
Did you mean: 

Problem accessing remote session bean

Former Member
0 Kudos

Hi,

I have a session bean which I'm trying to access remotely. If I lookup the bean this way:

Object ob = ctx.lookup("java:comp/env/EventHandlerBean");

I get

java.lang.Exception: Error instantiating EventProxy EJBcom.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at java:comp, the whole lookup name is java:comp/env/EventHandlerBean ...

(this lookup works fine if made from a JSP inside a web container deployed in the same ear that the bean)

I have to lookup this way:

Object ob = ctx.lookup("sap.com/myJarProject/EventHandlerBean");

to get the bean successfuly.

Is there any reason for this?

Thanks

Juan Manuel

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks for the help

Regards,

Juan Manuel

Vlado
Advisor
Advisor
0 Kudos

Hi Juan Manuel,

Please <a href="https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm#answered">close</a> the thread if your questions have been answered.

Best regards,

Vladimir

Vlado
Advisor
Advisor
0 Kudos

Hi Juan Manuel,

> Is there any reason for this?

Yes, the explanation can be found in <a href="http://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/accessing%20ejb%20applications%20using%20jndi.pdf">this</a> guide. It covers all aspects of EJB access via JNDI.

Hope that helps,

Vladimir

Former Member
0 Kudos

Hi Sanmarco,

In first case, your EJB is locally available within your EAR file. So, you can directly access that EJB using this java:comp/env path. This path is useful to find any EJB locally means within the same EAR.

But, if you have deployed EJB seperatly on WAS server and you want to access that ejb temotely then this EJB is registered in JNDI under the sap.com/<proj name>/<ejb name> path.

So, you have to give this path for look up.

If, you have specified any special JNDI name to your EJB in ejb-j2ee-engine.xml file then you can directly give this name in lookup.

Because now this EJB is registered under this name in JNDI registry.

Regards,

Bhavik

Former Member
0 Kudos

Read your environment variable support for the deployment of EJB. There should be something in help.sap.com about it.

Enjoy