GeeCON Prague 2014*
The moose likes Other Java Products and Servers and the fly likes lookup problem on SunOne 8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "lookup problem on SunOne 8" Watch "lookup problem on SunOne 8" New topic
Author

lookup problem on SunOne 8

Nilesh Yawale
Greenhorn

Joined: Dec 16, 2003
Posts: 11
Hello All,

I'm using SunOne 8 on Windows XP and trying to use the following code to lookup. Also I've verified the deployment of my application on the server.

Context initial = new InitialContext();
Object objref = initial.lookup("java:comp/env/ejb/test");

and appserv-rt.jar and j2ee.jar are in my classpath.

I'm getting javax.naming.NameNotFoundException: No object bound for java:comp/env/ejb/test exception.

Please let me know if anybody knows the probable reason or solution for the above issue.

Thanks for your time

Nilesh


Nilesh<br />SCJP<br />IBM certified for OOAD using UML
Aleks V. Pascoal
Ranch Hand

Joined: Apr 21, 2002
Posts: 73
Nilesh,
to use the context "java:comp/env" you have to map your ejb in any descriptor. If it's a servlet trying to get the reference this is done by ejb-ref in web.xml and the corresponding tag in sun proprietary descriptor.
If it's another ejb that's done in ejb-jar.xml and the sun proprietary descriptor.
If you don't wanna use this, you may get the reference using the absolute name, the JNDI name, withou the subcontext "java:comp/env".
For example, "ejb/MyDearEJB".

I hope it helps!
 
GeeCON Prague 2014
 
subject: lookup problem on SunOne 8