Question

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>?

Was it helpful?

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.

OTHER TIPS

You can find documentation in the docs directory of JBoss distribution docs/schema/jboss_5_0.xsd.

These element is the define as the local-jndi-nameType type and here is description for it:

The JNDI name under with the local interface should be bound. If it is not provided jboss will assume "jndi-name" = "beanClass/local"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top