This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven


Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am having this error in my jdeveloper environment when i tried to connect entity bean from session bean.
05/12/22 20:06:25 javax.naming.NameNotFoundException: Ship not found in SessionEJB

05/12/22 20:06:25 at
My ejb-jar.xml contains
<description>Entity Bean ( CMP )</description>

and in session bean i am trying like this
InitialContext ctx = OcmLocationMasterData.getInitialContext();
System.out.println("Context has been initialized");

Object objref=ctx.lookup("java:comp/env/Ship");
System.out.println("lookup finished");
ShipLocalHome home=(ShipLocalHome)PortableRemoteObject.narrow(objref,ShipLocalHome.class);
Long id = new Long(1);
ShipLocal result=home.create(id,"INSkundan","kolkata");

For initial context i am doing just
return new InitialContext();

Thanks for the help
Posts: 10445
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by kundan varma:
Object objref=ctx.lookup("java:comp/env/Ship");

Do the following:

Object objref=ctx.lookup("com.ocm.ShipLocal");
You've gotta fight it! Don't give in! Read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!