This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!