9.3.1 Defining other Enterprise Bean references
If the Enterprise Beans that form a J2EE application invoke other Enterprise Beans, set the properties for resolving the references.
- Organization of this subsection
(1) Attribute file to be edited
Edit the attribute file that maps to the types of Enterprise Beans forming the J2EE application.
-
Session Bean attribute file
-
Entity Bean attribute file
-
Message-driven Bean attribute file
(2) Acquiring the attribute file to be edited and setting the attributes
-
Acquiring the attribute file
Execute the following command to acquire an Enterprise Bean attribute file:
- Execution format
cjgetappprop [server-name] [-nameserver provider-URL] -name J2EE application-name -type ejb -resname EJB-JAR-display-name/Enterprise-Bean-display-name -c path-of-the-Enterprise-Bean-attribute-file
- Example of execution
cjgetappprop MyServer -name adder -type ejb -resname adder/adder_eb -c C:\home\adder_ejb.xml
-
Setting the attributes
Execute the following command to apply the values of the Enterprise Bean attribute file:
- Execution format
cjsetappprop [server-name] [-nameserver provider-URL] -name J2EE application-name -type ejb -resname EJB-JAR-display-name/Enterprise-Bean-display-name -c path-of-the-Enterprise-Bean-attribute-file
- Example of execution
cjsetappprop MyServer -name adder -type ejb -resname adder/adder_eb -c C:\home\adder_ejb.xml
(3) Attribute settings to be edited
The access types of Enterprise Beans to be referenced are as follows:
Access types of Enterprise Beans to be referenced |
Corresponding tags |
---|---|
Remote interface |
<ejb-ref> |
Local interface |
<ejb-local-ref> |
- Note:
-
The business interface (business-local and business-remote) cannot be changed as it is set in annotation.
The individual settings are explained below:
(a) Defining Enterprise Bean references for a remote interface
The following table describes the reference settings (<ejb-ref>) for the remote Enterprise Beans:
Items |
Mandatory |
Corresponding tags |
---|---|---|
Description |
O |
<description> |
Enterprise Bean reference name |
Y |
<ejb-ref-name> |
Type of Enterprise Bean to be referenced |
Y |
<ejb-ref-type> |
Remote home interface |
Y |
<home> |
Remote interface |
Y |
<remote> |
<ejb-name> to be linked |
O |
<ejb-link> |
(b) Defining the Enterprise Bean references for a local interface
The following table describes the reference settings (<ejb-local-ref >) for the local Enterprise Beans:
Items |
Mandatory |
Corresponding tags |
---|---|---|
Description |
O |
<description> |
Enterprise Bean reference name |
Y |
<ejb-ref-name> |
Type of Enterprise Bean to be referenced |
Y |
<ejb-ref-type> |
Local home interface |
Y |
<local-home> |
Local interface |
Y |
<local> |
<ejb-name> to be linked |
O |
<ejb-link> |
(4) Notes
-
When invoking the Enterprise Bean of a remote interface, you can set the Enterprise Bean in '<ejb-name> to be linked' (<ejb-link>), considering the Enterprise Bean existing in another application as the mapping destination.
If the Enterprise Bean to be mapped to is running on Cosminexus, you can specify the mapping destination in the following format by using the naming service switching functionality.
Specification format
corbaname::name-space-host-name:name-space-port-number#JNDI-name-of-the-EJBHome-object-reference
- Name-space-host-name
-
Specify the name of the host on which the namespace used by the mapping destination Enterprise Bean operates.
- Name-space-port-number
-
Specify the port number on which the namespace used by the mapping destination Enterprise Bean operates.
- JNDI-name-of-the-EJBHome-object-reference
-
Specify the JNDI name in the following format:
HITACHI_EJB/SERVERS/server-name/EJB/J2EE-APP-name/Enterprise-Bean-name
Server name: Name of a J2EE server
J2EE-APP-name: Lookup name of a J2EE application
Enterprise-Bean-name: Lookup name of an Enterprise Bean
Example of specification
corbaname::MyHost:900#HITACHI_EJB/SERVERS/MyServer/EJB/MyApplication/MyBean
-
When a naming service operates on the local host, do not use the string 'localhost' in ejbserver.naming.host key of the usrconf.properties file for the J2EE server; instead, specify the machine name or the IP address.