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/23 05:33:11 UTC
Cannot load JDBC driver class 'null'
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.html ,
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-examples-howto.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(BasicDataSource.java:529)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
at jkw.jsp.beans.SkillTypeBean.setTypeId(SkillTypeBean.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Any ideas?
Thanks,
John
--
John Walstra
jwalstra@spoonserver.com
john_walstra@yahoo.com
jwalstra@wi.rr.com
Don't abandon hope. Your Captain Midnight decoder ring arrives tomorrow.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Cannot load JDBC driver class 'null'
Posted by John Walstra <jw...@spoonserver.com>.
>From the mysql-connector-java-2.0.14 README ...
--
A simple connection example looks like:
Class.forName("com.mysql.jdbc.Driver").newInstance();
java.sql.Connection conn;
conn = DriverManager.getConnection(
"jdbc:mysql://localhost/test?user=blah&password=blah");
--
And if I un-jar their jar file, I can find it. There is also
"org.gjt.mm.mysql.Driver", which also returns the same Exception. I think
"org.gjt.mm.mysql.Driver" exists to be back-wards compatible. That is also
the driver class they use in the JNDI Datasource HOWTO.
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-examp
> > > >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(BasicDataSour
> > > >ce.j ava:529) at
> > > >org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.
> > > >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(DelegatingMethodAccess
> > > >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
> >
> >It is so stupid of modern civilisation to have given up believing in the
> >devil when he is the only explanation of it.
> > -- Ronald Knox, "Let Dons Delight"
> >
> >--
> >To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org> For additional
> > commands, e-mail: <ma...@jakarta.apache.org>
--
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
The unfacts, did we have them, are too imprecisely few to warrant our
certitude.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Re[2]: Cannot load JDBC driver class 'null'
Posted by John Walstra <jw...@spoonserver.com>.
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>
Re: Cannot load JDBC driver class 'null'
Posted by John Walstra <jw...@spoonserver.com>.
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Cannot load JDBC driver class 'null'
Posted by John Walstra <jw...@spoonserver.com>.
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-examp
> > > >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(BasicDataSour
> > > >ce.j ava:529) at
> > > >org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.
> > > >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(DelegatingMethodAccess
> > > >orIm pl.java:25)
> > > >
> > > >
> > > >Any ideas?
> > > >
> > > >Thanks,
> > > >John
> >
> >--
--
John Walstra
jwalstra@spoonserver.com
john_walstra@yahoo.com
jwalstra@wi.rr.com
Dieters live life in the fasting lane.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Cannot load JDBC driver class 'null'
Posted by Jacob Kjome <ho...@visi.com>.
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.html ,
> > >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-examples-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(BasicDataSource.j
> > >ava:529) at
> > >org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java
> > >:312) at jkw.jsp.beans.SkillTypeBean.setTypeId(SkillTypeBean.java:42) at
> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> > >sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > >39) at
> > >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> > >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
>
>It is so stupid of modern civilisation to have given up believing in the
>devil when he is the only explanation of it.
> -- Ronald Knox, "Let Dons Delight"
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Cannot load JDBC driver class 'null'
Posted by Kwok Peng Tuck <pe...@makmal.com>.
Well, when you listed the contents of your commons directory,
I didn't see it there, and it still isn't .But I'll take your word that
it is :) .
In this case, I'd double check to see if
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
is actually correct (the value attribute).
Oh yeah, is this suppose to be in the server.xml at all ?
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/jkw?autoReconnect=true</value>
</parameter>
I configured a datasource for tomcat to work with postgresql and don't remember including the url. Plus the docs don't mention this.
John Walstra 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.html ,
>>>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-examples-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(BasicDataSource.j
>>>ava:529) at
>>>org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java
>>>:312) at jkw.jsp.beans.SkillTypeBean.setTypeId(SkillTypeBean.java:42) at
>>>sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
>>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>>39) at
>>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
>>>pl.java:25)
>>>
>>>
>>>Any ideas?
>>>
>>>Thanks,
>>>John
>>>
>>>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Cannot load JDBC driver class 'null'
Posted by John Walstra <jw...@spoonserver.com>.
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.html ,
> >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-examples-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(BasicDataSource.j
> >ava:529) at
> >org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java
> >:312) at jkw.jsp.beans.SkillTypeBean.setTypeId(SkillTypeBean.java:42) at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> >sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> >39) at
> >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> >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
It is so stupid of modern civilisation to have given up believing in the
devil when he is the only explanation of it.
-- Ronald Knox, "Let Dons Delight"
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Cannot load JDBC driver class 'null'
Posted by Kwok Peng Tuck <pe...@makmal.com>.
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.html ,
>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-examples-howto.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(BasicDataSource.java:529)
> at
>org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
> at jkw.jsp.beans.SkillTypeBean.setTypeId(SkillTypeBean.java:42)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>
>Any ideas?
>
>Thanks,
>John
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>