Help coderanch get a
new server
by contributing to the fundraiser
  • 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

lookup problem on SunOne 8

Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic