tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Walstra <jwals...@spoonserver.com>
Subject Re: Cannot load JDBC driver class 'null'
Date Tue, 24 Sep 2002 13:18:01 GMT
Ok, I kick on any and all debug statements I could find. Is the 
UserTransaction suspose to be null?

2002-09-24 07:52:43 NamingContextListener[/localhost/localhost/jkw]: Creating 
JNDI naming context
2002-09-24 07:52:43 NamingContextListener[/localhost/localhost/jkw]:   
Resource parameters for jdbc/JKW = ResourceParams[name=jdbc/JKW, 
parameters={factory=org.apache.commons.dbcp.BasicDataSourceFactory, 
url=jdbc:mysql://mysql.spoonserver.com:3306/jkw?autoReconnect=true, 
password=, maxWait=10000, maxActive=100, 
driverClassName=org.gjt.mm.mysql.Driver, username=nobody, maxIdle=30}]
2002-09-24 07:52:43 NamingContextListener[/localhost/localhost/jkw]:   Adding 
resource ref jdbc/JKW
2002-09-24 07:52:43 NamingContextListener[/localhost/localhost/jkw]:   
ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factoryClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shareable},{type=auth,content=Container},{type=factory,content=org.apache.commons.dbcp.BasicDataSourceFactory},{type=url,content=jdbc:mysql://mysql.spoonserver.com:3306/jkw?autoReconnect=true},{type=password,content=},{type=maxWait,content=10000},{type=maxActive,content=100},{type=driverClassName,content=org.gjt.mm.mysql.Driver},{type=username,content=nobody},{type=maxIdle,content=30}]
2002-09-24 07:52:43 NamingContextListener[/localhost/localhost/jkw]:   
Resource parameters for UserTransaction = null



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/msg64346.
> > > > >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(BasicDataSo
> > > > >ur ce.j ava:529) at
> > > > >org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSourc
> > > > >e. java
> > > > >
> > > > >:312) at
> > > > >: jkw.jsp.beans.SkillTypeBean.setTypeId(SkillTypeBean.java:42) at
> > > > >
> > > > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> > > > >sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
> > > > >.j ava: 39) at
> > > > >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > > > >ss orIm pl.java:25)
> > > > >
> > > > >
> > > > >Any ideas?
> > > > >
> > > > >Thanks,
> > > > >John
> > >
> > >--

-- 
John Walstra
1002 North Stanford Street
Port Washington, WI 53074
H: (262) 284-2395
C: (847) 858-2395

jwalstra@spoonserver.com
john_walstra@yahoo.com
jwalstra@wi.rr.com

Sometimes I wonder if I'm in my right mind.  Then it passes off and I'm
as intelligent as ever.
		-- Samuel Beckett, "Endgame"

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message