Only 49 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting hold of another EJB in an EJB  RSS feed

 
Praveen Dharmavaram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using the following code to get hold of an EJB(Entity Bean) in another EJB.But it gives me an exception. Can anyone help.
InitialContext initCtx = new InitialContext();
Context ctx = initCtx.lookup("java:comp/env/ejb");
ABCHome abcHome = (ABCHome) ctx.lookup("ABC");
I get a
javax.naming.NameNotFoundException: Name "comp:java/env/ejb" not found in
context ("java:comp")
Thanks
Praveen
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you added an ejb-ref element for the ABC bean in your calling bean's deployment descriptor?
 
Praveen Dharmavaram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks mate...that worked..Thanks a lot
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!