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
java:comp/env/registerBean
Object lookup = ic.lookup("ejb/registerBean");
//javax.naming.NameNotFoundException: registerBean not found
Object lookup = ic.lookup("env/registerBean");
//javax.naming.NameNotFoundException
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
what?
My environment btw is NetBeans 4.1
Any help appreciated.
xabo - 21 Feb 2006 05:52 GMT
you might not have the correct entry for the resource ejb/registerBean
in web.xml
refer to the deployment-descriptor guidelines for the app-server you
are using.
for tomcat refer to
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
Paulus de Boska - 21 Feb 2006 11:25 GMT
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 :
http://localhost:8080/jmx-console/
then the jndiview service under JBoss
then invoke list
---
Paul Hamaker, SEMM
http://javalessons.com