老少爷们进来坐坐,看看这个问题如何解决。
问题描述:myeclipse中通过tomcat7将mysql数据库中的数据导出来时出现了问题,用的是jsp文件导出。mysql的jar文件已经导入,而且如果只写简单的jsp程序及不加载jdbc驱动这类的代码的话,是能够正常显示的不会报错。自己看了半天,还是没解决,写此贴希望大家能给点建议哈!
下面是报出异常的内容:
HTTP Status 500 -
--------------------------------------------
type Exception report
message
description
The server encountered an internal error () that prevented it from fulfilling this request.exception
org.apache.jasper.JasperException:
javax.servlet.ServletException:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.jasper.servlet.JspServletWrapper.handle
JspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
javax.servlet.
ServletException: java.lang.
ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840)
org.apache.jsp.ShowArticleTree_jsp._jspService(ShowArticleTree_jsp.java:149)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.Class
NotFoundException: com.mysql.jdbc.Driver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:126)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
org.apache.jsp.ShowArticleTree_jsp._jspService(ShowArticleTree_jsp.java:107)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.26 logs.
--------------------------------------------
Apache Tomcat/7.0.26
------解决方案--------------------java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
都提示你了,找不到mysql的驱动包
------解决方案--------------------导入mysql 驱动jar
------解决方案--------------------mysql -connector-java-5.1.0-bin.jar 是否放在 lib文件夹下 这个文件夹是提供程序运行时的jar
------解决方案--------------------org.apache.jasper.
JasperException: javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
很明显是木有导入mysql-connection-java.jar包。。
可选择不注册下载。。
http://www.mysql.com/downloads/connector/j/
------解决方案--------------------