J2EE/JNDI problem


Dakota Mon

J2EE/JNDI problem

the setup is this. I have an enterprise project that contains an ejb
module and a web module.

In the ejb module I have a session bean named "registerBean".

In the web module I have a servlet named "Control1"

SImply what I want to do is have Control1 do a lookup on registerBean
but this is where the code throws an exception. I have tried 4
different variations on doing the lookup. Each one is listed with the
error it generated in comments.

Object lookup = ic.lookup("java:comp/env/ejb/registerBean");
//javax.naming.NameNotFoundException: registerBean not found

Object lookup = ic.lookup("java:comp/env/registerBean");
//javax.naming.NameNotFoundException: No object bound to name

Object lookup = ic.lookup("ejb/registerBean");
//javax.naming.NameNotFoundException: registerBean not found

Object lookup = ic.lookup("env/registerBean");

Any ideas or thoughts? I am relatively new to J2EE and JNDI. From
searching on the web I have found numerous entries about a
"JNDI.properties" file. Where is this file and what should I add to it
if anything? Also should I edit one of the XML files and if so with

My environment btw is NetBeans 4.1

Any help appreciated.





Paulus de Boska

jndi.properties are taken care of by the app-server, you only need
those in a standalone client fe.
Every app-server has a JNDI viewer, there you can determine the exact
name you have to use.
For JBoss fe :
then the jndiview service under JBoss
then invoke list

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question