You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Will Stranathan <wi...@thestranathans.com> on 2001/09/30 23:41:53 UTC

InitialContext/Connection Pool/TC4

Using Tomcat 4.0 (the final version), obtaining a DataSource from JNDI 
implementation always returns null.  I'm not seeing anything in the logs 
that would indicate why.  Nor do I see anything in the logs saying that 
my connections had been initialized (and a netstat reveals that there 
are none.)

The lookup is successful, because it doesn't throw a NamingException 
(yes, I've tried deliberately misspelling the name to make sure it will 
when I use the wrong name.)  And I've got the JAR file for the driver in 
$TOMCAT_HOME/common/lib.  It just never returns a legitimate object of 
any sort - it just returns null.

The appropriate parts of conf/server.xml:

         <Context path="/will" docBase="will" debug="5" reloadable="true">
             <Logger className="org.apache.catalina.logger.FileLogger"
                 prefix="localhost_will_log." suffix=".txt"
                 timestamp="true"/>
             <Resource name="jdbc/LPDirectory" auth="SERVLET"
                 type="javax.sql.DataSource"/>
             <ResourceParams name="jdbc/LPDirectory">
                 <parameter>
                     <name>user</name>
                     <value>joeuser</value>
                 </parameter>
                 <parameter>
                     <name>password</name>
                     <value>joespassword</value>
                 </parameter>
                 <parameter>
                     <name>driverClassName</name>
                     <value>org.gjt.mm.mysql.Driver</value>
                 </parameter>
                 <parameter>
                     <name>driverName</name>
                     <value>jdbc:mysql://localhost/directory</value>
                 </parameter>
             </ResourceParams>
         </Context>

And the appropriate parts of webapps/will/WEB-INF/web.xml:

     <resource-ref>
         <description>The LP Directory</description>
         <res-ref-name>jdbc/LPDirectory</res-ref-name>
         <res-type>javax.sql.DataSource</res-type>
         <res-auth>Container</res-auth>
         <res-sharing-scope>Shareable</res-sharing-scope>
     </resource-ref>

Any ideas?

Thanks,
Will Stranathan