idea的那些坑(1)
来源:互联网 发布:单片机继电器 编辑:程序博客网 时间:2024/06/07 03:37
原文地址 http://blog.csdn.net/woaixiaozhe/article/details/7326915
确认包已经被导入web工程目录,但是任然运行错误——Java.lang.ClassNotFoundException: com.MySQL.jdbc.Driver。找不到
com.mysql.jdbc.Driver这个驱动。
报错信息如下:
HTTP Status 500 - Servlet execution threw an exceptiontype Exception reportmessage Servlet execution threw an exceptiondescription The server encountered an internal error that prevented it from fulfilling this request.exceptionjavax.servlet.ServletException: Servlet execution threw an exception org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)root causejava.lang.NoClassDefFoundError: com/mysql/jdbc/Driver com.wh.serveletDemo1.SearchServlet.getConnection(SearchServlet.java:29) com.wh.serveletDemo1.SearchServlet.CheckLogin(SearchServlet.java:43) com.wh.serveletDemo1.SearchServlet.doPost(SearchServlet.java:80) javax.servlet.http.HttpServlet.service(HttpServlet.java:650) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)root causejava.lang.ClassNotFoundException: com.mysql.jdbc.Driver org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858) org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701) com.wh.serveletDemo1.SearchServlet.getConnection(SearchServlet.java:29) com.wh.serveletDemo1.SearchServlet.CheckLogin(SearchServlet.java:43) com.wh.serveletDemo1.SearchServlet.doPost(SearchServlet.java:80) javax.servlet.http.HttpServlet.service(HttpServlet.java:650) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)note The full stack trace of the root cause is available in the Apache Tomcat/7.0.69 logs.
原来是tomcat找不到MYSQL JAR包的问题。后来又把mysql-connector-java-5.1.7-bin.jar导入到tomcat的lib目录下面就ok了,嘿…… 在java项目中,只需要引入mysql-connector-java-5.1.7-bin.jar就可以运行java项目。 在web项目中,当Class.forName("om.mysql.jdbc.Driver");时myeclipse是不会去查找字符串,不会去查找驱动的。所以只需要把
mysql-connector-java-5.1.7-bin.jar拷贝到tomcat下lib目录就可以了。
补充:1.如果web项目中有可运行的java,而且也用到了com.mysql.jdbc.Driver(即mysql),先运行下java,再运行web 不会出现这个问题,因为运行java时已经向项目导入了驱动; 2.MyEclipse9.0(其他版本的应该类似)的tomcat在MyEclipse安装路径的:MyEclipse\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201012172208\tomcat
阅读全文
1 0
- idea的那些坑(1)
- idea提示那些事
- 那些年遇到的那些坑
- IDEA的坑
- MeshCollider的那些坑
- UITextView的那些坑
- UITextView的那些坑
- cocos2dx的那些坑
- Python 的那些坑
- MJRefresh的那些坑
- MongoDB的那些坑
- Hibernate 的那些坑
- CocoaPods的那些坑
- FragmentPagerAdapter 的那些坑
- Xcode8的那些坑
- CALayer的那些坑!
- 那些ReactNative的坑
- string的那些坑
- PhEmail:基于Python的开源网络钓鱼测试工具
- SQL SERVER 统计一段时间内每天的数据
- BZOJ[4196][Noi2015]洛谷[2146]软件包管理器
- 函数指针定义和typedef
- 让textview字体大小自适应宽度
- idea的那些坑(1)
- UVA247CallingCircles
- Keil工程窗口各项图标描述
- 入门Webpack,看这篇就够了
- 教你改进小公司的软件测试流程
- Linux环境安装mysql 5.6注意事项
- ResNet论文翻译——中文版
- powerdesigne
- UOJ 34 多项式乘法(FFT)