java:comp exception in Tomcat 6

I don’t know if this will do anyone any good (please leave a comment if it helps you!), but I want to get myself into the habit of blogging these sort of things for the potential good of other web searchers out there.

We were having the following problem: when starting an web app in Tomcat 6 that uses JNDI to locate a database connection, we got the exception:
javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
Lots of people point out that this could be a problem with there being a JNDI implementation in the web app’s lib/, so that the app doesn’t get the global one defined by Tomcat, and they recommend removing all naming* JARs from lib/. But, in our case, it was catalina.jar that was causing the problem; it also includes a JNDI implementation.

2 Comments

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.