This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questions on context lookup local interface

 
jerry king
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
jerry king
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 580
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic