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: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>