Mapping the Enterprise Bean References

Although the application client and the web client access the same enterprise bean, their code refers to the bean's home by different names. The application client refers to the bean's home as ejb/SimpleConverter, but the web client refers to it as ejb/TheConverter. These references are in the parameters of the lookup calls. For the lookup method to retrieve the home object, you must map the references in the code to the enterprise bean's JNDI name. Although this mapping adds a level of indirection, it decouples the clients from the beans, making it easier to assemble applications from J2EE components.

To map the enterprise bean references in the clients to the JNDI name of the bean, follow these steps.

  1. In the tree, select ConverterApp.
  2. Click the Sun-specific Settings button.
  3. Select the JNDI Names in the View field.
  4. In the Application table, note that the JNDI name for the enterprise bean is ConverterBean.
  5. In the References table, enter ConverterBean in the JNDI Name column for each row.

Figure 24-1 shows what the JNDI Names tab should look like after you've performed the preceding steps.

ConverterApp JNDI Names

Figure 24-1 ConverterApp JNDI Names