• java.lang.ClassNotFoundException: com.mysql.jdbc.Driver问题


    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at com.google.model.ConnDB.getConn(ConnDB.java:16)
    at com.google.model.GoodsBeanBO.getGoodsBean(GoodsBeanBO.java:23)
    at com.google.servlet.showGoodsClServlet.doGet(showGoodsClServlet.java:41)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:722)
    java.lang.NullPointerException
    at com.google.model.GoodsBeanBO.getGoodsBean(GoodsBeanBO.java:25)
    at com.google.servlet.showGoodsClServlet.doGet(showGoodsClServlet.java:41)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:722)

    必须把mysql-connector-java-5.1.7-bin.jar导入到tomcat的lib目录下面! 

    在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目录就可以了。

    同时多谢  http://www.cnblogs.com/swxj/archive/2013/06/05/3119206.html#commentform 这位朋友的帖子!!

  • 相关阅读:
    (转)视频编码标准汇总及比较
    (转)live555从RTSP服务器读取数据到使用接收到的数据流程分析
    (转)MPEG4码流简单分析
    H264裸流分析中,能获取哪些信息?
    (转)基于live555的流媒体代理转发服务器
    测试x264编码器的低延时编码和非延时编码
    ELK 日志分析系统
    Dubbox:来自当当网的SOA服务框架
    CHMOD命令怎么用?
    linux显示文件列表命令ls,使用ls --help列出所有命令参数
  • 原文地址:https://www.cnblogs.com/yousen/p/4463802.html
Copyright © 2020-2023  润新知