用myeclipse写的jsp代码连接mysql数据库,总是出现下面的问题,怎么解决????求帮助
HTTPStatus500-typeExceptionreportmessagedescriptionTheserverencounteredaninternalerro...
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: An exception occurred processing JSP page /connect.jsp at line 15
12:
13: <body>
14: <%
15: Class.forName("com.mysql.jdbc.Driver");
16: Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/student","root","1424081546");
17: Statement sta=conn.createStatement();
18: String sql="INSERT INTO stu(cod,name)VALUES('2','zha')";
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
org.apache.jsp.connect_jsp._jspService(connect_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
org.apache.jsp.connect_jsp._jspService(connect_jsp.java:71)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the
Apache Tomcat/6.0.10 logs.
Apache Tomcat/6.0.10 展开
type Exception report
message
description The server encountered an internal error () that
prevented it from fulfilling this request.
exception org.apache.jasper.JasperException: An exception occurred processing JSP page /connect.jsp at line 15
12:
13: <body>
14: <%
15: Class.forName("com.mysql.jdbc.Driver");
16: Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/student","root","1424081546");
17: Statement sta=conn.createStatement();
18: String sql="INSERT INTO stu(cod,name)VALUES('2','zha')";
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
org.apache.jsp.connect_jsp._jspService(connect_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
org.apache.jsp.connect_jsp._jspService(connect_jsp.java:71)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the
Apache Tomcat/6.0.10 logs.
Apache Tomcat/6.0.10 展开
5个回答
展开全部
exception org.apache.jasper.JasperException:
An exception occurred processing JSP page /connect.jsp at line 15
这个异常说明 connect.jsp第15行有问题.
root cause javax.servlet.ServletException:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
找不到com.mysql.jdbc.Driver这个Driver类
2017-11-08
展开全部
把mysql*.jar放到tomcat\lib目录中
~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你要放一个mysql的驱动包在你项目的lib文件夹下
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-19
展开全部
楼上说的对,是缺少com.mysql.jdbc.Driver
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询