javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp] error with java scheduler javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp] error with java scheduler sql sql

javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp] error with java scheduler


This error shows that your jdbc resource is not registered! Where did you put your context.xml?

The context.xml file must be in the META-INF directory of the war file. It must not be in the classes directory or in a jar file.

Put the META-INF directory with the context.xml in the directory containing the root of the webapp in your source folder tree.


Try stopping and restarting your server (I assume you are using Eclipse and a Tomcat server). Maybe when you created your context xml file as it did was empty initially, your server was not able to synchronize its contents hence its inability to find the database connection resource name you later specified in the context.xml file.

i.e. if you have not already solved this problem.


I had the same problem which dragged on for two painful days. I Re-read tomcat documentation about JNDI, confirmed all my server.xml, context.xml,web.xml configuration and the code to access the naming object... still no progress.

It turned out to be a dependency in my project that was interfering with the naming context - axis2. A simple move from axis2-1.6.0 to axis2-1.6.2 caused my problem.