Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes How does JNDI name is allocated or created in JNDI namespace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How does JNDI name is allocated or created in JNDI namespace " Watch "How does JNDI name is allocated or created in JNDI namespace " New topic
Author

How does JNDI name is allocated or created in JNDI namespace

Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
I am using following tutorial to learn ejb3 ,

http://www.laliluna.de/download/first-ejb3-tutorial-en.pdf

In this tutorial the the remote interface for a session bean is BookTestBeanRemote and implementing class name
is BookTestBean. This class has a variable

public static final String RemoteJNDIName = BookTestBean.class.getSimpleName() + "/remote";

The client program look for this name in context.lookup i.e

BookTestBeanRemote beanRemote = (BookTestBeanRemote) context.lookup(BookTestBean.RemoteJNDIName);

I am confused as in JNDI namespace the bean is registered as BookTestBean ,so why author has added /remote in front of
bean name to create the RemoteJNDIName?
How and why the server is able to find the ejb BookTestBean/remote whereas the bean is registered as BookTestBean.

Thanks.
Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
I found the answere of my question on Jboss 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.

I got no replies for this question and I thought it was a stupid question , but it wasn't

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How does JNDI name is allocated or created in JNDI namespace