tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilja Hehenkamp" <>
Subject Re: Tomcat, MySQL & JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'
Date Fri, 19 Sep 2003 17:41:09 GMT
Remy Maucherat, can you elobarate on this deployer client? You talked about 
it, but it can nowhere be found. I'm still very stuck on this matter and 
don't have a way of fixing it... Deploying is a pain in the ass now compared 
to the convenient way of building with ant...

>From: Ilja Hehenkamp <>
>Subject: Re: Tomcat, MySQL & JNDI: java.sql.SQLException: Cannot load JDBC 
>driver class 'null'
>Date: Fri, 19 Sep 2003 19:37:46 +0200
>>>Sorry, I don't really understand what you mean?
>>>Do you mean I shouldn't use the build file anymore? If so: that's too  
>>>since I like the way of automated updating the tomcat manager...
>>I'm sure you do. You seem to be stuck on that particular page of the
>>docs, however, which happens to be out of date, and doesn't actually
>>mention what is important.
>>Read the deployer page instead
>>( ).
>>>But still: I don't know how to fix the problem: why doesn't the jndi
>>>datasource work with the through ant deployed application?
>>Because I don't think your stuff in server.xml is used at all.
>>>>That's much better.
>>>>I recommend you use the deployer package instead. The instructions  from
>>>>appdev are going to be updated or removed.
>>>>>I think I know where lies the problem, however I still don't know  how

>>>>>to fix
>>>>>I use the sample build.xml file from Tomcat:
>>>>> build.xml.txt

>>>>>install, reload and distribute my sample application.
>>>>>When I do an ant -install it apparantly installs the application in  
>>>>>Tomcat manager, however the application doesn't show up in the  webapps
>>>>>directory. That's 1.
>>>>>So maybe there's a conflict with either the context path, which I  
>>>>>think so, since my build file has explicitly set the context path to
>>>>>  <property name=""      value="DBTest"/>
>>>>>  <property name="app.path"      value="/${}"/>
>>>>>  <property name="app.version"   value=""/>
>>>>>  <property name="build.home"    value="${basedir}/build"/>
>>>>>  <property name="catalina.home" value="/Library/Tomcat"/> <!--
>>>>>  <property name="dist.home"     value="${basedir}/dist"/>
>>>>>  <property name="docs.home"     value="${basedir}/docs"/>
>>>>>  <property name="manager.url"   value="  http://localhost:8080/manager

>>>>>  <property name="src.home"      value="${basedir}/src"/>
>>>>>  <property name="web.home"      value="${basedir}/web"/>
>>>>>Or there's a conflict with the docbase, which I suspect... However  I'm

>>>>>sure why and how to fix it....
>>>>>Because when I put the generated war file (when doing an ant -dist)  in

>>>>>webapps directory the connection works! Although this works, it's  not

>>>>>convenient, since it defeats the purpose of the automated  installing

>>>>>Hope I made myself clear?
>>>>>>Ok, first some configuration information:
>>>>>>Tomcat 5.09
>>>>>>MySQL Driver 3.08 stable
>>>>>>OS: Mac OSX 10.2.6
>>>>>>J2SE 1.4.2
>>>>>>all commons libraries reside in $CATALINA_HOME/common/lib
>>>>>>MySQL Driver resides in $CATALINA_HOME/common/lib as well
>>>>>>I tried setting up a simple JNDI datasource connection but get  the  
>>>>>>following error message:
>>>>>>java.sql.SQLException: Cannot load JDBC driver class 'null'
>>>>>>        at  

>>>>>>        at  

>>>>>>        at foo.DBTest.init(
>>>>>>        at foo.TestServlet.doGet(
>>>>>>        at  
>>>>>>        at  
>>>>>>          ....
>>>>>>          ....
>>>>>>The code and examples are taken from  
>>>>>>I have searched through tons of archives and websites and mostly 

>>>>>>error could be resolved by placing the driver and commons in the  
>>>>>>common/lib directory. However in my case they are there, so I  
>>>>>>figure out what's the problem...
>>>>>><Context path="/DBTest" docBase="DBTest" debug="5"
>>>>>>      reloadable="true" crossContext="true">
>>>>>><Logger className="org.apache.catalina.logger.FileLogger"
>>>>>>                  directory="logs"  prefix="localhost_DBTest_log." 
>>>>>>             timestamp="true"/>
>>>>>>      <Resource name="jdbc/TestDB"
>>>>>>                auth="Container"
>>>>>>                type="javax.sql.DataSource"/>
>>>>>>  <ResourceParams name="jdbc/TestDB">
>>>>>>   <parameter>
>>>>>>    <name>driverClassName</name>
>>>>>>    <value></value>
>>>>>>   </parameter>
>>>>>>   <parameter>
>>>>>>    <name>username</name>
>>>>>>    <value>xxx</value>
>>>>>>   </parameter>
>>>>>>   <parameter>
>>>>>>    <name>password</name>
>>>>>>    <value>xxx</value>
>>>>>>   </parameter>
>>>>>>   <parameter>
>>>>>>    <name>url</name>
>>>>>>    <value>jdbc:mysql://localhost/javatest?autoReconnect=true</
>>>>>>   </parameter>
>>>>>>  </ResourceParams>
>>>>>><?xml version="1.0" encoding="ISO-8859-1"?>
>>>>>>     <!DOCTYPE web-app PUBLIC
>>>>>>     "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>>>>>>     " ">
>>>>>>   <description>MySQL Test App</description>
>>>>>>   <resource-ref>
>>>>>>       <description>DB Connection</description>
>>>>>>       <res-ref-name>jdbc/TestDB</res-ref-name>
>>>>>>       <res-type>javax.sql.DataSource</res-type>
>>>>>>       <res-auth>Container</res-auth>
>>>>>>   </resource-ref>
>>>>>>   <servlet>
>>>>>>       <servlet-name>DBTestServlet</servlet-name>
>>>>>>       <description>
>>>>>>         Bla...
>>>>>>       </description>
>>>>>>       <servlet-class>foo.TestServlet</servlet-class>
>>>>>>   </servlet>
>>>>>>   <servlet-mapping>
>>>>>>       <servlet-name>DBTestServlet</servlet-name>
>>>>>>       <url-pattern>/DBTestServlet</url-pattern>
>>>>>>   </servlet-mapping>

MSN Zoeken, voor duidelijke zoekresultaten!

View raw message