Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How does JNDI name is allocated or created in JNDI namespace

 
Mishaal Khan
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic