Setting Up EJB References

An Enterprise Java Bean can be called from a web module (WAR) or from an EJB module (JAR). An EJB is referenced in three files/locations:
  1. In the web.xml Standard J2EE descriptor, there is an EJB references section in the web module.

    For example:

      <ejb-ref>
        <ejb-ref-name>ejb/greeter</ejb-ref-name>
        <ejb-ref-type>Entity</ejb-ref-type>
        <home>pack.TheGreeterHome</home>
        <remote>pack.TheGreeter</remote>
        <ejb-link>TheGreeter</ejb-link>
      </ejb-ref>
    

    Where:
    <ejb-ref-name> - is the EJB reference name. The iPlanet Application Server looks for the actual JNDI string used in the servlet Java source code.

    ejb-link - is the actual bean name specified in the <ejb-name> tag of the EJB entry in ejb-jar.xml file. The EJB reference name and the actual bean name are different.

  2. In the ias-web.xml iPlanet Application Server Deployment Descriptor.

    For example:

      <ejb-ref>
        <ejb-ref-name>ejb/greeter</ejb-ref-name>
        <jndi-name>ejb/TheGreeter</jndi-name>
      </ejb-ref>
    

    Where:
    <ejb-ref-name> - is the reference name in the web-xml file.
    <jndi-name> - is the value prefixed by ejb/ to the ejb-link value.

    To use EJB modules in JNDI references, you should use the bean name and the EJB module name.

    For example, the JNDI name can be set as: <ejb-link>EJBModule_Name/TheGreeter</ejb-link>

    or

    <jndi-name>ejb/EJBModule_Name/TheGreeter</jndi-name>

    The iPlanet Application Server supports both these JNDI name configurations.

  3. In the servlet lookup code. The JNDI name in the servet refers to the EJB through its EJB reference name.

    For example:

    String JNDI_NAME = "java:com/env/ejb/greeter"

    You can identify an EJB reference name to "Kamille" and use it in the JNDI lookup as String JNDI_NAME = "java:com/env/Kamille". The iPlanet Application Server will resolve to the correct EJB.  
    See also
      Using the Reference Mappings Property Editor
    Using the Resource Reference Mappings Property Editor


    Legal Notices