JBoss.org Community Documentation

Chapter 18. Binding your beans in JNDI

By default, when the application is deployed in a jar, session beans will bind to JNDI in the form ejbName/remote for remote interfaces and ejbName/local in the case of local interfaces. When the EJBs are deployed in an .ear file, the default jndi binding will be prepended by the name of the .ear file. So if the ear file name is foo.ear the default jndi names would be foo/EJB-NAME/remote and foo/EJB-NAME/local. You can override this behavior by defining your own @org.jboss.ejb3.annotation.LocalBinding and/or @org.jboss.ejb3.annotation.RemoteBinding.

Local Interface JNDI Binding :

To change the JNDI name for your local interface use the @org.jboss.ejb3.annotation.LocalBinding annotation.

				
@Stateless
@LocalBinding(jndiBinding="custom/MySession")
public class MySessionBean implements MySession
{
}

				
			

Remote Interface JNDI Binding :

To change the JNDI name for your remote interface use the @org.jboss.ejb3.annotation.RemoteBinding annotation.

				
@Stateless
@RemoteBinding(jndiBinding="custom/remote/MySession")
public class MySessionBean implements MySession
{
}