• Post Reply Bookmark Topic Watch Topic
  • New Topic

How does context.lookup work ?  RSS feed

 
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.
 
Prabhat Jha
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remote and Local automatically gets alligned to <Bean-Name>Remote and <Bean-Name>Local JNDI
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!