• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NameNotFoundException

 
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 com.oracle.naming.J2EEContext.getSubContext(J2EEContext.java:93)
My ejb-jar.xml contains
<entity>
<description>Entity Bean ( CMP )</description>
<display-name>Ship</display-name>
<ejb-name>Ship</ejb-name>
<local-home>com.ocm.ShipLocalHome</local-home>
<local>com.ocm.ShipLocal</local>
<ejb-class>com.ocm.ShipBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Long</prim-key-class>


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
kundan
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");
reply
    Bookmark Topic Watch Topic
  • New Topic