• Post Reply Bookmark Topic Watch Topic
  • New Topic

NameNotFoundException

 
kundan varma
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 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
 
Jaikiran Pai
Sheriff
Posts: 10447
227
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");
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!