码迷,mamicode.com
首页 > 数据库 > 详细

java连接数据库时出现如下错误:

时间:2015-08-21 01:47:13      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:

java.lang.ClassNotFoundException: com.mysql.jdbc.driver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.skybird.util.SqlHelper.<clinit>(SqlHelper.java:47)
at com.skybird.model.UserService.checkUser(UserService.java:25)
at com.skybird.controller.LoginVerify.doPost(LoginVerify.java:47)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:881)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:674)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:541)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Unknown Source)

之后解决错误:

Java连接mysql时出现错误:java.lang.ClassNotFoundException: com.mysql.jdbc.Driver (2013-08-14 15:20:12)转载▼
标签: java mysql 杂谈    分类: 2013
解决办法如下:
 

mysql-connector-java-5.1.26-bin.jar要导入工程中。
在eclipse中只要右击工程文件夹属性选项-Java  Build Path-Add Extenal Archives 添加即可……
加入后可在.classpath文件中看到

 

参照实例:

http://www.cnblogs.com/longwu/articles/2310577.html

 

解决问题参照:

http://blog.sina.com.cn/s/blog_9c5d29f70101ckuu.html

 

其他的有类似的问题的解决方案有所不同;

 

java连接数据库时出现如下错误:

标签:

原文地址:http://www.cnblogs.com/blogofwyl/p/4746609.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!