Use JNDI View in jmx-console to see what is actually bound.
I am new to jboss and and looking through the posts to find my problem with JNDI which looks very similar to the one that codemyth has. Mine though is with a simple data source using jboss 3.2.6. Codemyth's problem was related to jndi-ejb lookups.
Here is my source:
part of web.x.xml where my datasource is defined:
part of jboss-web.xml where a different resource-ref is defined for jboss (I don't know WHY I need this but I found it on a different forum saying that I would need to define it here - so I did and here it is!):
Next is my snippet of code that looks up the resource:
log.info ("Creating initial context");
initCtx = new InitialContext(props);
log.info ("Getting honeypot datasource!");
dataSource = (DataSource)initCtx.lookup ("java:comp/env/jdbc/honeypot");
log.info ("Getting Connection!");
Now part of the exception trace that I am getting:
2004-12-08 16:04:38,221 INFO [STDOUT] javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: jdbc not bound]
2004-12-08 16:04:38,231 INFO [STDOUT] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:972)
2004-12-08 16:04:38,231 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:615)
Now I can print out the JNDI tree under "java:comp/env/jdbc" and I do see the "honeypot" entry. But when I look it up this is where I get the exception.
Where are you trying to access the EJBs? In the web tier? If so, you must define the reference in web.xml and jboss-web.xml files.