This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes JDBC error with Tomcat startup (upgraded to jdk 5) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC error with Tomcat startup (upgraded to jdk 5)" Watch "JDBC error with Tomcat startup (upgraded to jdk 5)" New topic
Author

JDBC error with Tomcat startup (upgraded to jdk 5)

Robert Bonslater
Greenhorn

Joined: Jan 30, 2005
Posts: 28
Hi everybody,

installed jdk 1.5 from jdk 1.4 on Tomcat server environment. My JDBC connection with my driver was working fine until I installed the new java version. What has changed since 1.4?

Here's the error message:
java.sql.SQLException: Cannot load JDBC driver class 'org.gjt.mm.mysql.Driver'
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:529)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:312)
at com.wrox.tourism.db.util.DBInitServlet.init(DBInitServlet.java:34)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1044)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:88
7)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3820)
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Appears to be a classpath problem at the first look, the jar file containing MySQL JDBC driver cannot be found by Tomcat (if you are setting up the connection pool in Tomcat) or by your application.

Have you checked if it is present in the locations that Tomcat includes jar files from?


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Robert Bonslater
Greenhorn

Joined: Jan 30, 2005
Posts: 28
What is the name of this jar file that must be recognized by the classpath?
Annie Smith
Ranch Hand

Joined: Mar 05, 2005
Posts: 172
Originally posted by Robert Bonslater:
What is the name of this jar file that must be recognized by the classpath?


It should be mysqldb.jar or something similar.


Cheers!<br /><b>Annie</b>
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

mysql jdbc drivers

My sql connector/j
Robert Bonslater
Greenhorn

Joined: Jan 30, 2005
Posts: 28
Thanks guys, I finally got it.

Just needed to place that "mysql-connector-java-3.0.16-ga.jar" file into my JAVA_HOME\jre\lib\ext directory. The downfall of this though is that I might forget again when upgrading java versions again. The best thing for me to do is set it in my classpath environment.
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Robert,

Are you setting up a connection pool through Tomcat?

If so, I think you are supposed to have the jar file in the Tomcat common/lib directory. There are some subtle issues with class loading when using an application server, see if you can find some more information on setting up classpath for Tomcat.

HTH.
 
wood burning stoves
 
subject: JDBC error with Tomcat startup (upgraded to jdk 5)
 
Similar Threads
java.lang.ClassCastException error
Determine which jdk version for tomcat
Tomcat 4.0.4 & Redhat Linux
which jdbc driver i am using
jdbc driver error v9.1.3