Quick Fix - Tomcat: Name java:comp is not bound in this Context
An application that was running fine started throwing this exception on startup: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context. Tracing showed it came from code that was used to glean the database connection information from the environment (configured through context XML files).
Finally I retraced all of my steps and found one thing that I had changed. For the sake of the developers, I moved the Tomcat common/lib directory to the WEB-INF of the only application on this server and created a symlink to it from common/lib. After undoing this the application started working again.
Ultimately the problem is this: if you put a JAR that overrides the javax.servlet class in the WEB-INF/lib directory, the application context will no longer be available and any usage of Context.lookup() will fail. For those recieving this error while using the code right out of the Tomcat documentation for datasource resource lookups (which happens to be the first chunk of code on the page), there is a good chance that this is your problem. The code that was throwing this error for me was textbook–straight out of that documentation.
help a lot after almost 5 hrs of hit and trial i deleted duplicate jar files from lib of my context
and it was working
Thanks, i had found some threads stating a similar solution but yours was very clear. I noticed on startup that Tomcat was producing an error loading the servlet jar file. I deleted all my jars that weren’t needed and ‘wala’ fixed. Thanks again.