my dog learned polymorphism
The moose likes Websphere and the fly likes Error looking up EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Error looking up EJB" Watch "Error looking up EJB" New topic

Error looking up EJB

Regis Santos
Ranch Hand

Joined: Mar 23, 2004
Posts: 31

How can I access a local EJB from a servlet by its JNDI name when both application are not in the same EAR?

Both application are running in the same server (WebSphere 6.1). But when I invoke the context.lookup() method passing the JNDI name as parameter, I got a NamingExecption.

This is my code:



Error message:

There's no EJB reference binding in the ibm-web-bnd.xmi.

[ December 12, 2007: Message edited by: Regis Santos ]

Regis Santos
Sachin Vrma

Joined: Jan 19, 2007
Posts: 7
You just have to add one entry in your ibm-web-bnd.xmi...
Add id for the ejb reference in the web.xml

Add corresponding entry in ibm-web-bnd.xmi for providing the jndi name...

[ December 17, 2007: Message edited by: Sachin Vrma ]
[ December 17, 2007: Message edited by: Sachin Vrma ]
Regis Santos
Ranch Hand

Joined: Mar 23, 2004
Posts: 31
Hello Sachin,

I did as you told me. But I got the following exception when the servlet tried to find the local EJB via JNDI.

I tried to change the JNDI name for
but it wasn't work, too.

These are my deployment descriptors:





FYI: the EJB module and the WAR are in the same EAR.

I agree. Here's the link:
subject: Error looking up EJB
It's not a secret anymore!