You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stephen Riek <st...@yahoo.co.uk> on 2003/02/19 13:08:26 UTC
changes between tomcat 4.0.x and 4.1.x ? mysql dbcp gotcha
Just spent hours debugging a problem with MySQL DBCP.
My webapp was working perfectly under 4.0.3 but upon upgrading to 4.1.18, the very same webapp failed, with an annoying "Cannot create JDBC driver of class org.gjt.mm.mysql.Driver" error.
I solved the problem by changing this first Resource config in server.xml (which worked in 4.0.3),
<Resource name="jdbc/cms" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/cms">
<parameter>
<name>user</name>
<value>myuser</value>
</parameter>
<parameter>
<name>password</name>
<value>*******</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>driverName</name>
<value>jdbc:mysql://localhost/cms</value>
</parameter>
</ResourceParams>
To this which worked in 4.1.18,
<Context path="/cms" docBase="cms">
<Resource name="jdbc/cms" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/cms">
<parameter>
<name>username</name>
<value>myuser</value>
</parameter>
<parameter>
<name>password</name>
<value>*******</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/cms?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>
Note that I had to use the 'url' and 'username' parameters instead of 'DriverName' and 'user'.
Why was this required ? where should I have found all these caveats in the upgrade ? Are there any other hidden gotchas in moving from 4.0.x to 4.1.x ? (Eg. I've noticed that I can not access servlets simply by knowing their package name - eg. "/servlet/com.mydomain.servletname". Now in 4.1.x, servlets can only be accessed if they have a servlet mapping in web.xml)
Stephen.
---------------------------------
With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your needs