Tomcat 6找不到mysql驱动 [英] Tomcat 6 can't find mysql driver

查看:354
本文介绍了Tomcat 6找不到mysql驱动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有一个类似的问题,但关于类路径。
ClassNotFoundException com.mysql.jdbc.Driver

There is a similar question here but regarding the class path. ClassNotFoundException com.mysql.jdbc.Driver

直到几天前,我的一切都运转良好。突然我的小应用程序找不到mysql驱动程序。而且我不明白为什么(我确实已经检查了所有内容)

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)

我在WEB-INF / lib中获得了驱动程序jar,但tomcat似乎无法找到它。

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

任何人都有任何想法的原因?
我正在使用带有tomcat 6的Ubuntu和从synaptics packadge manager安装的mysql

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

给出的错误是:

ClassNotFoundException: com.mysql.jdbc.Driver

我甚至将权限更改为777以查看它是否可以是不可见的,但它不是:(

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

推荐答案

如果您创建了一个需要此驱动程序的数据源,那么它应该直接放在管理数据源的容器的类路径中。在这种情况下,它是管理数据源的Tomcat。因此,将驱动程序放在 Tomcat / lib 你会没事的。

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.

除此之外,你告诉过你正在使用Ubuntu。默认使用GNU JDK。我只强烈建议你确保你摆脱它并安装Sun JDK .GNU JDK杂乱无章,可能会导致乍一看无法解释的问题。希望你把它带入考虑。

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.

这篇关于Tomcat 6找不到mysql驱动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆