It's not a secret anymore!
The moose likes EJB and other Java EE Technologies and the fly likes Unable to Find EJB in JNDI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Unable to Find EJB in JNDI" Watch "Unable to Find EJB in JNDI" New topic

Unable to Find EJB in JNDI

Russ Ray
Ranch Hand

Joined: Feb 11, 2003
Posts: 52
Good Morning to All!

I have been scratching my head all day yesterday trying to understand this error:

[2005-06-15 09:44:38,203][Servlet.Engine.Transports : 1][FATAL][{ServiceLocator}{getHome}{CONFIG0001}{Failed to find EJB Reference from JNDI tree}{External Message:Name comp/env/ejb not found in context "java:".}]
{ServiceLocator}{getHome}{CONFIG0001}{Failed to find EJB Reference from JNDI tree}{External Message:Name comp/env/ejb not found in context "java:".}

What is going on is the user is logging into the web application. The process is the user comes in from the web container and enters the EJB container through the AdminEJB. The AdminEJB has a reference to a singleton POJO entitled ServiceLocator. This POJO follows the locator pattern. One of the things the Locator is attempting to accomplish is retrieving the CacheEJBLocalHome. This Cache ejb has a JNDI name of
I have promoted the Cache ejb to the Local and the Remote interfaces using WSAD.

I realize the lookup method can not find the EJB, but I do not know what is causing this behavior. I originally thought the AdminEJB needed a bean reference to the CacheEJB, but this did not work.

Any insight or debugging techniques into this issue would be greatly appreciated.

Thank you for reading my post.

Milind V. Kulkarni

Joined: Apr 12, 2002
Posts: 17
Check whether EJB is properly deployed or not. This kind of error is encountered only when EJB is not deployed correctly.

Aravind Kumar
Ranch Hand

Joined: Nov 03, 2003
Posts: 39
comp/env/ejb is private environment for AdminEJB...the actual JNDI location should be java:/ejb/CacheHomeEJB
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
The recommended ejb context of the bean�s environment is java:comp/env/ejb. So, you would expect the home interface to be found by looking up the JNDI tree for "java:comp/env/ejb/CacheHomeEJB".

The recommended subcontexts of the bean's environment for other resource manager connection factory references are:
java:comp/env/service (web service)
java:comp/env/jdbc (JDBC)
java:comp/env/jms (JMS)
java:comp/env/mail (JavaMail)
java:comp/env/url (URL)

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
vv sreeram

Joined: Aug 28, 2003
Posts: 16
I am getting a similar error. I have added an BMP entity bean to an existing application. When i try to look up the bean i am getting the following error

javax.naming.NameNotFoundException: Name "ejb/DMT/NpSpeedMaintHome" not found in context "local:".
Should i set the context somewhere so that this bean is in the local context ??

Thank You
I agree. Here's the link:
subject: Unable to Find EJB in JNDI
It's not a secret anymore!