Looking up Enterprise JavaBeans in WebSphere Application Server V5
 Technote (troubleshooting)
 
Problem(Abstract)
When looking up Enterprise JavaBeans™ in releases of IBM® WebSphere® Application Server V5, can I use a global JNDI name instead of Enterprise JavaBeans references?
 
Resolving the problem
Yes, you can use global JNDI names to lookup Enterprise JavaBeans.
Object myEJB=initialContext.lookup("ejb/AccountEJB");

It is a recommended programming best practice to lookup Enterprise JavaBeans using Enterprise JavaBean References. With Enterprise JavaBean references, the Application Component providers call the Enterprise JavaBeans using any name in the lookup call.

Object myEJB = initialContext.lookup("java:comp/env/ejb/myEJB");

An Enterprise JavaBeans reference is used to resolve the name to the actual Enterprise JavaBeans using WebSphere Application Server bindings which can be specified at deployment time. The indirection provided with Enterprise JavaBean references provides flexibility as the dependencies can be modified in line with the production environment without requiring a change in the application code. For the example above, the Enterprise JavaBeans reference would be ejb/myEJB and it would be resolved to ejb/AccountEJB.

Enterprise JavaBeans references can be established for Enterprise JavaBeans calling other Enterprise JavaBeans, or for calls in a Web module to an Enterprise JavaBean. The WebSphere Application Server binding information for Enterprise JavaBeans calling other Enterprise JavaBeans is stored in the ibm-ejb-jar-bnd.xmi file and for a Web module calling an Enterprise JavaBean, in the ibm-web-bnd.xmi file. Tools such as the IBM Application Server Toolkit for WebSphere Application Server or WebSphere Studio Application Developer can be used to specify the WebSphere Application Server binding information for an application. As mentioned above, the Enterprise JavaBeans reference can also be specified at application installation time through the Administrative Console or wsadmin.
 
 
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 > EJB Container
Operating system(s): Windows
Software version: 5.1
Software edition:
Reference #: 1066953
IBM Group: Software Group
Modified date: Oct 1, 2004