You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Walstra <jw...@spoonserver.com> on 2002/09/24 17:58:17 UTC

Re: Re[2]: Cannot load JDBC driver class 'null'

I'm actually on the full version of 4.1.12 now, and still the same problem. 

For now I'm not using a pool, which makes my pages load like a dog. I'm 
thinking I'm going to have to try some other type of pooling if DBCP won't 
work for me or try something beside Tomcat.

On Tuesday 24 September 2002 10:18 am, Jacob Kjome wrote:
> Hello John,
>
> Unfortunately, I can't find anything wrong with your configuration.
> If your .jar file is common/lib and the driver that you reference is
> named correctly and actually exists in your jar file, then I'm at a
> loss.
>
> One question... You are using the *full* release of Tomcat-4.1.11,
> right?  If you are using the JDK-1.4 lite version, then remove that
> and install the full version.  The light version doesn't come with all
> the stuff you need for JNDI datasources.
>
> That's about all I can think of.  Sorry I can't be of more help.  If
> you solve your problem, let me know how you solved it.
>
> Jake
>
> Tuesday, September 24, 2002, 8:18:01 AM, you wrote:
>
> JW> Ok, I kick on any and all debug statements I could find. Is the
> JW> UserTransaction suspose to be null?
>
> JW> 2002-09-24 07:52:43 NamingContextListener[/localhost/localhost/jkw]:
> Creating JW> JNDI naming context
> JW> 2002-09-24 07:52:43 NamingContextListener[/localhost/localhost/jkw]:
> JW> Resource parameters for jdbc/JKW = ResourceParams[name=jdbc/JKW,
> JW> parameters={factory=org.apache.commons.dbcp.BasicDataSourceFactory,
> JW> url=jdbc:mysql://mysql.spoonserver.com:3306/jkw?autoReconnect=true,
> JW> password=, maxWait=10000, maxActive=100,
> JW> driverClassName=org.gjt.mm.mysql.Driver, username=nobody, maxIdle=30}]
> JW> 2002-09-24 07:52:43 NamingContextListener[/localhost/localhost/jkw]:  
> Adding JW> resource ref jdbc/JKW
> JW> 2002-09-24 07:52:43 NamingContextListener[/localhost/localhost/jkw]:
> JW>
> ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factor
>yClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Sha
>reable},{type=auth,content=Container},{type=factory,content=org.apache.commo
>ns.dbcp.BasicDataSourceFactory},{type=url,content=jdbc:mysql://mysql.spoonse
>rver.com:3306/jkw?autoReconnect=true},{type=password,content=},{type=maxWait
>,content=10000},{type=maxActive,content=100},{type=driverClassName,content=o
>rg.gjt.mm.mysql.Driver},{type=username,content=nobody},{type=maxIdle,content
>=30}] JW> 2002-09-24 07:52:43
> NamingContextListener[/localhost/localhost/jkw]: JW> Resource parameters
> for UserTransaction = null
>
> JW> On Tuesday 24 September 2002 6:17 am, John Walstra wrote:
> >> Ok since I'm getting no where fast, is there way to debug a DataSource?
> >> Look it's settings?
> >>
> >> On Sunday 22 September 2002 11:14 pm, Jacob Kjome wrote:
> >> > Yes, it should find it.  Have you verified that the class in the
> >> > driverClassName element actually does exist in that package in the jar
> >> > file you just mentioned?
> >> >
> >> > Jake
> >> >
> >> > At 10:56 PM 9/22/2002 -0500, you wrote:
> >> > >I do have mysql-connector-java-2.0.14-bin.jar in the common/lib
> >> > > directory. Shouldn't it find the correct class being there?
> >> > >
> >> > >On Sunday 22 September 2002 10:39 pm, Kwok Peng Tuck wrote:
> >> > > > Are you actually using the mysql driver? Cause if it says loading
> >> > > > driver null, means there isn't one.
> >> > > >
> >> > > > John Walstra wrote:
> >> > > > >I'm trying to set up a JNDI connection to MySQL. I'm using the
> >> > > > > binary release of 4.1.11 with 4.0.4's jasper-compiler.jar and
> >> > > > > jasper-runtime.jar. I'm also using mysql-connector-java-2.0.14.
> >> > > > >
> >> > > > >It's very similar to this thread
> >> > > > >http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg643
> >> > > > >46. ht ml , however I still can't get mine working after reading
> >> > > > > that thread. I've basically followed (cut and paste) the JNDI
> >> > > > > Datasource HOWTO,
> >> > > > > http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-
> >> > > > >exa mp les-h owto.html .
> >> > > > >
> >> > > > >Here is the Context section of my server.xml
> >> > > > >
> >> > > > >        <Context path="/jkw"
> >> > > > >
> >> > > > > docBase="/usr/local/web/meta-htdocs/JWALSTRA/htdocs/jsp"
> >> > > > > debug="5" useNaming="true"
> >> > > > >                reloadable="true" crossContext="true">
> >> > > > >
> >> > > > >             <Logger
> >> > > > > className="org.apache.catalina.logger.FileLogger"
> >> > > > > prefix="jkw_log." suffix=".txt"
> >> > > > >                     timestamp="true"/>
> >> > > > >
> >> > > > >             <Resource name="jdbc/JKW"
> >> > > > >                     auth="Container"
> >> > > > >                     type="javax.sql.DataSource"/>
> >> > > > >
> >> > > > >             <ResourceParams name="jdbc/JKW">
> >> > > > >                     <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>nobody</value>
> >> > > > >                     </parameter>
> >> > > > >                     <parameter>
> >> > > > >                             <name>password</name>
> >> > > > >                             <value></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://localhost:3306/jkw?autoReconnect=true</value>
> >> > >
> >> > > > >                     </parameter>
> >> > > > >             </ResourceParams>
> >> > > > >        </Context>
> >> > > > >
> >> > > > >Here is my web.xml
> >> > > > >
> >> > > > ><?xml version="1.0" encoding="ISO-8859-1"?>
> >> > > > >
> >> > > > ><!DOCTYPE web-app
> >> > > > >    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> >> > > > > 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
> >> > > > >
> >> > > > ><web-app>
> >> > > > >
> >> > > > >  <taglib>
> >> > > > >    <taglib-uri>
> >> > > > >      /orataglib
> >> > > > >    </taglib-uri>
> >> > > > >    <taglib-location>
> >> > > > >      /WEB-INF/tlds/orataglib_1_0_3.tld
> >> > > > >    </taglib-location>
> >> > > > >  </taglib>
> >> > > > >
> >> > > > >  <taglib>
> >> > > > >    <taglib-uri>
> >> > > > >      /jkw
> >> > > > >    </taglib-uri>
> >> > > > >    <taglib-location>
> >> > > > >      /WEB-INF/tlds/jkw-1.0.tld
> >> > > > >    </taglib-location>
> >> > > > >  </taglib>
> >> > > > >
> >> > > > >  <resource-ref>
> >> > > > >    <description>MySQL DB Connection</description>
> >> > > > >    <res-ref-name>jdbc/JKW</res-ref-name>
> >> > > > >    <res-type>javax.sql.DataSource</res-type>
> >> > > > >    <res-auth>Container</res-auth>
> >> > > > >  </resource-ref>
> >> > > > >
> >> > > > ></web-app>
> >> > > > >
> >> > > > >My common/lib directory ... (jasper* is from 4.0.4)
> >> > > > >
> >> > > > >-rw-r--r--    1 root     root        45386 Sep 19 08:30
> >> > > > > activation.jar -rw-r--r--    1 root     root       716139 Sep 19
> >> > > > > 08:30 ant.jar -rw-r--r--    1 root     root        90503 Sep 19
> >> > > > > 08:30
> >> > > > >commons-collections.jar
> >> > > > >-rw-r--r--    1 root     root        62998 Sep 19 08:30
> >> > > > > commons-dbcp.jar -rw-r--r--    1 root     root        16910 Sep
> >> > > > > 19 08:30
> >> > > > >commons-logging-api.jar
> >> > > > >-rw-r--r--    1 root     root        28930 Sep 19 08:30
> >> > > > > commons-pool.jar -rw-r--r--    1 root     root       210191 Sep
> >> > > > > 22 21:40
> >> > > > > jasper-compiler.jar -rw-r--r--    1 root     root        67077
> >> > > > > Sep 22 21:40 jasper-runtime.jar -rw-r--r--    1 root     root
> >> > > > > 84854 Sep 19 08:30 jdbc2_0-stdext.jar -rw-r--r--    1 root    
> >> > > > > root 98496 Sep 19 08:30 jndi.jar
> >> > > > >-rw-r--r--    1 root     root         8674 Sep 19 08:30 jta.jar
> >> > > > >-rw-r--r--    1 root     root       280984 Sep 19 08:30 mail.jar
> >> > > > >-rw-r--r--    1 root     root       125961 Sep 22 21:27
> >> > > > >mysql-connector-java-2.0.14-bin.jar
> >> > > > >-rw-r--r--    1 root     root        28664 Sep 19 08:30
> >> > > > > naming-common.jar -rw-r--r--    1 root     root        18222 Sep
> >> > > > > 19 08:30 naming-factory.jar -rw-r--r--    1 root     root       
> >> > > > > 37601 Sep 19 08:30
> >> > > > > naming-resources.jar -rw-r--r--    1 root     root        80054
> >> > > > > Sep 19 08:30 servlet.jar
> >> > > > >
> >> > > > >Here is my code sniplet ...
> >> > > > >
> >> > > > >    Connection conn = null;
> >> > > > >    Statement stmt = null;
> >> > > > >    ResultSet rset = null;
> >> > > > >
> >> > > > >    Context ctx = new InitialContext();
> >> > > > >    if(ctx == null )
> >> > > > >    {
> >> > > > >      throw new Exception("Boom - No Context");
> >> > > > >    }
> >> > > > >
> >> > > > >    DataSource ds = (DataSource)ctx.lookup(
> >> > > > > "java:comp/env/jdbc/JKW");
> >> > > > >
> >> > > > >    try
> >> > > > >    {
> >> > > > >      conn = ds.getConnection();
> >> > > > >      stmt = conn.createStatement();
> >> > > > >
> >> > > > >And the error message ...
> >> > > > >
> >> > > > >java.sql.SQLException: Cannot load JDBC driver class 'null'
> >> > > > >        at
> >> > > > >org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDat
> >> > > > >aSo ur ce.j ava:529) at
> >> > > > >org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSo
> >> > > > >urc e. java
> >> > > > >
> >> > > > >:312) at
> >> > > > >: jkw.jsp.beans.SkillTypeBean.setTypeId(SkillTypeBean.java:42) at
> >> > > > >
> >> > > > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> >> > > > >sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorI
> >> > > > >mpl .j ava: 39) at
> >> > > > >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodA
> >> > > > >cce ss orIm pl.java:25)
> >> > > > >
> >> > > > >
> >> > > > >Any ideas?
> >> > > > >
> >> > > > >Thanks,
> >> > > > >John
> >> > >
> >> > >--

-- 
John Walstra
jwalstra@spoonserver.com
john_walstra@yahoo.com
jwalstra@wi.rr.com

"Say yur prayers, yuh flea-pickin' varmint!"
-- Yosemite Sam

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>