2.3.1 Types of names used for lookup
With Application Server, you can use the following four types of names for lookup:
- Looking up with the Portable Global JNDI names
A lookup method for which you specify a name beginning with java:global, java:app, or java:module (Portable Global JNDI name) defined in Java EE. You can use this method to look up the Enterprise Beans or J2EE resources.
- Looking up with names using java:comp/env
A lookup method for which you specify a name that uses java:comp/env defined in Java EE. You can use this method to look up the Enterprise Beans or J2EE resources.
- Looking up with names beginning with HITACHI_EJB
A lookup method for which you specify a name that is automatically bound using the Application Server-specific naming rules. You can use this method to look up Enterprise Beans.
- Looking up with the optional names assigned by the user-specified name space functionality
A lookup method for which you specify the optional name registered by using an Application Server-specific functionality (user-specified name space functionality). You can use this method to look up the Enterprise Beans or J2EE resources.
The following table describes the lookup method that can be used and the recommended lookup method for each form of EJB client.
Table 2-4 Types of lookup methods
Form of EJB Client | Lookup methods |
---|
Looking up with the Portable Global JNDI names | Looking up with names using java:comp/env | Looking up with names beginning with HITACHI_EJB | Looking up with the optional names assigned by the user-specified name space functionality |
---|
EJB client applications | R | N | Y | Y |
JSPs, servlets | Y | R | Y | Y |
EJBs | Y | R | Y | Y |
- Legend:
- R: Usage is recommended
- Y: Available
- N: Not available
The following points describe the lookup names and the methods of lookup using those names:
- Organization of this subsection
- (1) Looking up with the Portable Global JNDI names
- (2) Looking up with names using java:comp/env
- (3) Looking up with names beginning with HITACHI_EJB
- (4) Looking up with the optional names assigned by the user-specified Name Space functionality
(1) Looking up with the Portable Global JNDI names
The following points describe how to define the names, the lookup range, and features for looking up with the Portable Global JNDI names:
- Definition method
A lookup using the Portable Global JNDI names includes lookup with automatically bound names and lookup with names specified in the resource reference definitions.
- To look up automatically bound names
A name is automatically assigned to the object reference when a J2EE application is deployed on Application Server. This name is defined using the naming rules provided in Java EE and begins with java:global, java:app, or java:module. This name is called the Portable Global JNDI name.
- To look up names specified in the resource reference definitions
You specify the Portable Global JNDI name in the resource reference definition for the DD.
- Range that can be looked up
You can look up the Enterprise Beans or J2EE resources in all the J2EE servers or EJB client applications that use the same CORBA Naming Service.
- Features
When a J2EE application is deployed, the EJB home object reference corresponding to the Enterprise Bean, and the business interface reference are automatically bound to names beginning with java:global, java:app, or java:module. A name space conflict can be avoided because the standard application name or standard module name is assigned to the bound name. Also, the Portable Global JNDI names are common to Application Servers created by different companies, so you need not amend the source code and the DD when the J2EE applications are migrated between Application Servers.
For details on looking up with the Portable Global JNDI names, see 2.4 Looking up with the Portable Global JNDI names. Also, for details on the standard application name and standard module name, see 2.4.2 Automatically bound objects.
(2) Looking up with names using java:comp/env
The following points describe how to define the names, the lookup range, and features for looking up names using java:comp/env:
- Definition method
Defines the mapping of the links between the reference names defined in Java EE using java:comp/env and the actual names in the DD resource references. This resolves the link between the reference names and the actual names during deployment.
- Range that can be looked up
You can look up in one component. However, in the case of Web applications, you can look up in one Web application.
- Features
java:comp/env is the context root of the name space defined in Java EE. You can use java:comp/env to look up between different EJB-JAR and Web applications in a J2EE application and to look up J2EE resources.
The specifications for looking up names using java:comp/env follow the Java EE provisions.
(3) Looking up with names beginning with HITACHI_EJB
The following points describe how to define the names, the lookup range, and features for looking up names beginning with HITACHI_EJB:
- Definition method
A name is automatically assigned to the object reference when a J2EE application is deployed on Application Server. This name is defined using the Application Server-specific naming rules.
- Range that can be looked up
You can look up the Enterprise Beans in all the J2EE servers or EJB applications that use the same CORBA Naming Service.
- Features
When a J2EE application is deployed, the EJB home object reference corresponding to the Enterprise Bean, and the business interface reference are automatically bound to names beginning with HITACHI_EJB. A name space conflict can be avoided because the server name and application name of the J2EE application is assigned to the bound name.
For details on looking up with names beginning with HITACHI_EJB, see 2.5 Looking up with names beginning with HITACHI_EJB.
(4) Looking up with the optional names assigned by the user-specified Name Space functionality
The following points describe how to define the names, the lookup range, and features for looking up with the optional names assigned by the user-specified Name Space functionality:
- Definition method
Uses the user-specified name space functionality of Application Server to define an optional name for the Enterprise Beans or J2EE resources.
- Range that can be looked up
You can look up the Enterprise Beans or J2EE resources in all the J2EE servers that use the same CORBA Naming Service.
- Features
In the case of the Enterprise Beans, if you use the user-specified Name Space functionality, you can register the optional names for the EJB home object references or business interface references combined with binding the name to the JNDI name. You can also register the optional names for the J2EE resources (resource adapter, mail configuration, and JavaBeans resource).
By registering an optional name, you can look up the Enterprise Beans and J2EE resources with any user-specified name.
For details on assigning optional names for the Enterprise Beans or J2EE resources, see 2.6 Assigning an optional name to the Enterprise Beans or J2EE resources (User-specified name space functionality).
- Reference note
- The Java EE specifications recommend looking up with the names using java:comp/env.