You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/08/23 23:50:08 UTC

DO NOT REPLY [Bug 22677] New: - JNDI not working in Default Context

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=22677>.
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=22677

JNDI not working in Default Context

           Summary: JNDI not working in Default Context
           Product: Tomcat 4
           Version: 4.1.27
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: peter.harrison@nothingbutnet.co.nz


I and a few other users seem to have an issue with JNDI datasources defined in
the default context, or in the global resources. When defined in a specific
Context there is no issue (except it defeats the ability to automatically
deploy), however if a JNDI resource is defined in DefaultContext or
GlobalNamingResources we get a error.

There are two errors depending on where the resource-ref is. If there is a
resource-ref in the web.xml you get a:
java.sql.SQLException: Cannot load JDBC driver class 'null'
If you define the Resource in the server.xml you get 
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

    *  Version - Tomcat 4.1.27 also reported in v5.0

    * Tomcat component - Catalina

    * Platform - Intel/PC

    * OS - Mandrake 9.

    * JVM - 1.4

    * Web Server - none 

    * Configuration - 

server.xml-->

<DefaultContext>

<ResourceParams name="jdbc/foo">
<parameter><name>username</name><value>foo</value></parameter>
<parameter><name>password</name><value>foo</value></parameter>
<parameter><name>driverClassName</name>
	<value>org.postgresql.Driver</value></parameter>
<parameter><name>url</name>
	<value>jdbc:postgresql://localhost/foo</value></parameter>
</ResourceParams>
</DefaultContext>

web.xml-->

  <resource-ref>
      <description>Foo Database</description>
      <res-ref-name>jdbc/foo</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>


    * Log file excerpts and Stack Traces 


DEBUG (LoginAction.java:36) - peter
ERROR (OfficeUserImpl.java:45) - SQL Exception : Cannot load JDBC driver class
'null'
java.sql.SQLException: Cannot load JDBC driver class 'null'
        at
nz.co.asterisk.arpt.dao.OfficeUserBase.getConnection(OfficeUserBase.java:301)
        at
nz.co.asterisk.arpt.dao.implementation.OfficeUserImpl.verifyUser(OfficeUserImpl.java:27)
        at nz.co.asterisk.arpt.actions.LoginAction.perform(LoginAction.java:44)
        at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
        at java.lang.Thread.run(Thread.java:536)
DEBUG (LoginAction.java:60) - Failed Login