Servlets and JSPs use EJB references to instantiate proxies for EJB home interfaces. See Chapter 8, “Creating Enterprise JavaBeans Clients,” for more information. EJB references must be cataloged in the deployment descriptor so that the Web application can run independent of a specific naming configuration. When deploying the Web application, a site administrator can specify site-specific EJB JNDI names.
Servlets and JSPs can look up an EJB by specifying the reference name prefixed with java:comp/env/. For example, if you enter ejb/catalog in EAServer Manager, use java:comp/env/ejb/catalog in your JSP or servlet source code.
To add or configure an EJB reference, open the Web Application Properties dialog box.
The EJB References tab configuration is the same for Web applications, application clients, and EJB components.
Adding an EJB reference
Display the EJB References tab.
Click Add. A reference with default settings is created. Edit the settings as described below.
Editing an EJB reference
If necessary, display the EJB References tab. Existing references are displayed as a list with one row for each reference.
Edit the reference fields of interest as follows:
Name Specifies the JNDI name used in your code to refer to the called
EJB. The aliased name is displayed in the Link Value field. Enter
the part of the JNDI name that begins with ejb/
.
For example, if your code refers to java:comp/env/ejb/MyBean,
enter ejb/MyBean
.
Type Choose Session for session Beans or Entity for entity Beans.
Home The Java class name of the EJB home interface, specified in dot
notation. For example, com.sybase.MyBeanHome
.
Remote The Java class name of the EJB remote interface, specified in
dot notation. For example, com.sybase.MyBeanRemote
.
Link Value The actual JNDI name EJB component that is installed in the server where your component, Web application, or application client is to be deployed. This must match the JNDI name property in the Component Properties of the called EJB component.
For invocations of components on remote servers, you can also specify a corbaname interoperable naming URL, as described in “Interoperable naming URLs”.
To delete a reference, click anywhere in the fields for the reference of interest and click Delete.
Copyright © 2005. Sybase Inc. All rights reserved. |