File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes How does context.lookup work ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "How does context.lookup work ?" Watch "How does context.lookup work ?" New topic
Author

How does context.lookup work ?

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.
Prabhat Jha
Ranch Hand

Joined: Aug 13, 2007
Posts: 58
Remote and Local automatically gets alligned to <Bean-Name>Remote and <Bean-Name>Local JNDI


Thanks,
Prabhat
SCJP 1.5, SCWCD 1.5, SCBCD 1.5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How does context.lookup work ?
 
Similar Threads
EJB 3 javax.naming.Communication Exception
How does JNDI name is allocated or created in JNDI namespace
Type mapping trouble with JAX-WS and EJB3
javax.naming.NoInitialContextException ?
EJB 3 javax.naming.Communication Exception