Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Tomcat 5 - Cannot load JDBC driver class 'null' SQL state: null

christopher justin

2004-01-06


A solution to this problem would be greatly appreciated. I have now spent
over 10 hours investigating this problem, and still have no solution. We
have installed Tomcat 5 and the latest MySQl ConnectorJ driver on 3
different platforms, and experience this annoying, what seems to be common
problem, yet no solution with Tomcat 5. I have configured, re-configured,
followed discussion forems (mainly related to Tomcat 4). The mysql
connectorJ jar file is in $CATALINA/common/lib like stated at
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
. There something not documented or clear in the docs, as many people are
having this issue.

Here is the SQLException

Error: java.sql.SQLException: Cannot load JDBC driver class 'null' SQL
state: null

Here is a snap shot of the server.xml file:
<GlobalNamingResources>
  <Environment description="Absolute Pathname of the JWSDP Installation"
name="jwsdp.home" override="true" type="java.lang.String"
value="C:\jwsdp-1.3"/>
  <Environment name="simpleValue" override="true" type="java.lang.Integer"
value="30"/>
  <!-- Editable user database that can also be used by UserDatabaseRealm
to authenticate users -->
  <Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase" description="User database that can
be updated and saved">
  </Resource>
  <ResourceParams name="UserDatabase">
   <parameter>
    <name>factory</name>
    <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
   </parameter>
   <parameter>
    <name>pathname</name>
    <value>conf/tomcat-users.xml</value>
   </parameter>
  </ResourceParams>

  <Context path="/AuthorizedTest" docBase="AuthorizedTest" debug="5"
reloadable="true" crossContext="true">
  <Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest_log." suffix=".txt" timestamp="true"/>

  <Resource name="jdbc/AuthorizedTest"
         auth="Container"
         type="javax.sql.DataSource"/>

  <ResourceParams name="jdbc/AuthorizedTest">
  <parameter>
   <name>factory</name>
   <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
  </parameter>

  <!-- Maximum number of dB connections in pool. Make sure you
     configure your mysqld max_connections large enough to handle
     all of your db connections. Set to 0 for no limit.
     -->
  <parameter>
   <name>maxActive</name>
   <value>100</value>
  </parameter>

  <!-- Maximum number of idle dB connections to retain in pool.
     Set to 0 for no limit.
     -->
  <parameter>
   <name>maxIdle</name>
   <value>30</value>
  </parameter>

  <!-- Maximum time to wait for a dB connection to become available
     in ms, in this example 10 seconds. An Exception is thrown if
     this timeout is exceeded. Set to -1 to wait indefinitely.
     -->
  <parameter>
   <name>maxWait</name>
   <value>10000</value>
  </parameter>

  <!-- MySQL dB username and password for dB connections -->
  <parameter>
  <name>username</name>
  <value>local_local</value>
  </parameter>
  <parameter>
  <name>password</name>
  <value>walkon03</value>
  </parameter>

  <!-- Class name for mm.mysql JDBC driver -->
  <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
  </parameter>

  <!-- The JDBC connection url for connecting to your MySQL dB.
     The autoReconnect=true argument to the url makes sure that the
     mm.mysql JDBC Driver will automatically reconnect if mysqld closed
the
     connection. mysqld by default closes idle connections after 8
hours.
     -->
  <parameter>
   <name>url</name>
   
<value>jdbc:mysql://www.local-underground.com:3306/local_maillist?autoReconnect=true</value>
  </parameter>
</ResourceParams>
</Context>
</GlobalNamingResources>


Here is a snap shot of our WEB-INF/web.xml file:
<resource-ref>
   <description>DB Connection</description>
   <res-ref-name>jdbc/AuthorizedTest</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
</resource-ref>


Does anyone have a successful Tomcat 5 and MySQL Connector J configuration?
In desparate need of the correct configuration. Thanks all.

chris

_________________________________________________________________
Make your home warm and cozy this winter with tips from MSN House & Home.
http://special.msn.com/home/warmhome.armx


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.