aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Questions on context lookup local interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Questions on context lookup local interface" Watch "Questions on context lookup local interface" New topic
Author

Questions on context lookup local interface

jerry king
Greenhorn

Joined: Nov 05, 2008
Posts: 12
Hi all,

i have implement two container managed session bean (beanA, beanB), and they are in the same applications. I can call beanA through a client program by following code:
Context ctx = new InitialContext();
beanARemote beanA = (beanARemote )ctx.lookup("beanA");

and i can call beanB through beanA as follow
Context ctx = new InitialContext();
beanBRemote beanB = (beanBRemote)ctx.lookup("beanB");

My question is , if beanA and beanB is in the same EJB container, i can't get the local interface through context.lookup("beanB")? Please kindly advise me on this.....

thank you!!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10266
    
168

Originally posted by jerry king:
My question is , if beanA and beanB is in the same EJB container, i can't get the local interface through context.lookup("beanB")?


As long as the two beans are part of the same JVM, you can use the local interface. So yes, in this example you can use the local interface of beanB from beanA.


[My Blog] [JavaRanch Journal]
jerry king
Greenhorn

Joined: Nov 05, 2008
Posts: 12
Thank you for your reply. When i try to get local interface , i get the following excetpion:
Exception returned by remote server: {0}
javax.naming.NameNotFoundException: ASessionEJB not found

I am using Oracle 10.1.3.1 AS
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Jerry,

The likely cause is that the JNDI name is not correct. Take a look at this thread: http://forums.oracle.com/forums/message.jspa?messageID=1147428.

My co-author, Debu Panda, can definitely help you with this. I am not all that familiar with OC4J myself. Try posting here: http://www.manning-sandbox.com/forum.jspa?forumID=273.

Regards,
Reza
[ November 05, 2008: Message edited by: Reza Rahman ]

Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Questions on context lookup local interface