views:

778

answers:

4

Hey,

There is a similar question here but regarding the class path. http://stackoverflow.com/questions/1585811/classnotfoundexception-com-mysql-jdbc-driver

I've had everything working great until some days ago. Suddenly my little application can't find the mysql driver. And i don't understand why (really I've checked everything)

I got the driver jar in the WEB-INF/lib, but tomcat just seems unable to find it.

Anyone got any ideas why? I'm using Ubuntu with tomcat 6 and mysql installed from the synaptics packadge manager

The error that is giving is:

ClassNotFoundException: com.mysql.jdbc.Driver

I've even changed the permissions into 777 to see if it could be invisibile, but it isn't :(

+3  A: 

Try putting the MySQL JDBC driver in $CATALINA_HOME/lib and restart the web server. Also, make sure the tomcat user (or whatever user you are running tomcat as) has permissions to read it.

Asaph
A: 

Add the jar file in tomcat lib. I think you can delete the jar file from application's WEB-INF/lib, because then there might be two definitions for one class. So just copy the jar file in tomcat lib. hope this helps. :)

tony_le_montana
+3  A: 

If you created a datasource which requires this driver, then it should be placed directly in the classpath of the container which manages the datasource. In this case, it's Tomcat which manages the datasource. Thus, with placing the driver in Tomcat/lib you'll be fine.

Apart from that, you told you're using Ubuntu. It ships by default with a GNU JDK. I would only highly recommend that you ensure that you get rid of it and install the Sun JDK instead. The GNU JDK is cluttered of bugs which may cause at first sight unexplainable problems. Hope you take this into consideration.

BalusC
I changed it and now it finds the driver in web-inf/lib ty
fmsf
A: 

Are you getting this error while compile or when you run application?

peter_budo