Search code examples
jndijboss5.xejb-2.x

difference bewteen <jndi-name> and <local-jndi-name> in Jboss.xml?


I am new to EJB and trying to run some EJB (2.0) examples in Jboss 5. The execution is ok, but I found in the jboss.xml these lines:

<jboss>
    <enterprise-beans>
        <session>
            <ejb-name>MyStatelessBean</ejb-name>
            <jndi-name>JNDIName</jndi-name>
            <local-jndi-name>LocalJNDIName</local-jndi-name>
        </session>
    </enterprise-beans>
</jboss>

I have tried to google but cannot find the explanation of the distinct between <jndi-name> and <local-jndi-name>, While in the code, the author only used the name defined in <jndi-name>?


Solution

  • EJB 2.x beans have both Remote and Local interfaces. The <jndi-name> element is for binding the Remote interface, while <local-jndi-name> is for binding the local interface.

    The reason the naming is inconsistent is that EJB 1.x only had remote interfaces, so only <jndi-name> was necessary.