开发者

Tomcat 6 can't find mysql driver

There is a similar question here but regarding the class path. 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.Drive开发者_运维问答r

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


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.


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.


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. :)


Download "mysql-connector-java-5.1.13-bin.jar" from following link http://sqlworkbench.mgm-tp.com/viewvc/trunk/sqlworkbench/junit/mysql-connector-java-5.1.13-bin.jar?revision=2294&pathrev=2294 and copy it to "Tomcat/lib" folder ie..."$CATALINA_HOME/lib" folder and restart Tomcat

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜