DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14568>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14568

servlet.init() can't access JNDI DB resources

           Summary: servlet.init() can't access JNDI DB resources
           Product: Tomcat 4
           Version: 4.1.12
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Servlet & JSP API
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I just upgraded from Tomcat 4.0.3 to 4.1.12 and now my servlet.init() methods 
fail to access the JNDI DB resources.

Context initCtx = new InitialContext(); // Works fine
Context envCtx = (Context) initCtx.lookup("java:comp/env");  // Works fine
DataSource ds = (DataSource)envCtx.lookup("jdbc/mydatabase"); // Fails here

The message I get in the log file is:
MyServlet: error loading data.javax.naming.NameNotFoundException: Name
jdbc is not bound in this Context

The lookup works fine if I call the servlet directly--the doGet() method uses 
the exact same call as the init() method.

It almost seems that the JNDI resources are defined after the servlet.init() 
methods are called.

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>

Reply via email to