JNDI lookup of an EJB local home interface fails with a NameNotFoundException
 Technote (troubleshooting)
 
Problem(Abstract)
In WebSphere® Application Server V5 or V6, a direct JNDI lookup of an EJB local home interface fails with a NameNotFoundException. In addition, the EJB local home interface does not appear in the output from the dumpNameSpace command.
 
Cause
This is the expected behavior. EJB local home interfaces are bound to the local name space (per application), not the global name space. To access an EJB local home interface, an EJB local reference must be created in the deployment descriptor of the application module, and the application must do an indirect (through the java:comp/env context) JNDI lookup of the EJB local home interface.

You can also use the dumpNameSpace utility for java: name spaces to confirm that the EJB local home interface is present in the name space.

 
Resolving the problem
Use the Application Server Toolkit, WebSphere Studio Application Developer, or Rational® Application Developer to edit your deployment descriptor and create an EJB local reference.

This will create the following entry in the deployment descriptor:

<ejb-local-ref>
<ejb-ref-name>ejb/MyPackage/LocalHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.mycompany.mypackage.MySessionLocalHome</local-home>
<local>com.mycompany.mypackage.MySessionLocal</local>
</ejb-local-ref>

You will also need to modify the application that does the JNDI lookup to use a JNDI name of "java:comp/env/ejb/MyPackage/LocalHome".

The part of the JNDI name that comes after "java:comp/env" is whatever is entered for <ejb-ref-name> in the <ejb-local-ref> in the deployment descriptor.

 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > JNDI/Naming
Operating system(s): Windows
Software version: 6.0.2.6
Software edition:
Reference #: 1228212
IBM Group: Software Group
Modified date: Jan 18, 2006