Hi, We are doing a JNDI Lookup in our utility class like this. Context ctx = new InitialContext(); DataSource ds = ctx.lookup("jdbc/dbSource"); But in the sample code i have seen, the lookup looks like this. DataSource ds = ctx.lookup("java:comp/env/jdbc/dbSource"); Now, 1. Is there a difference in these two lookups? 2. When we do the second lookup, it throws the naming exception. This might be because for Web Modules -> Resource References name and the jndi names are different. but I am not sure. Please let me know if you have some inputs.
Thanks & Regards, Nijeesh.
Thanks & Regards,<br />Nijeesh.
posted 13 years ago
The top one looks it up from the global JNDI namespace. The second one looks up a name defined in the ejb-jar.xml as being local to that particular EJB (which is bound to a name in the global namespace during deployment). Read Richard Monson-Haefel's EJB book for an explanation of how JNDI works and what the two mean. Kyle