日期:2014-05-17  浏览次数:20708 次

学习jsp+dao,数据库连接出问题,数据插入不成功,大家能帮我看看什么原因吗
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 /dao/daodemo01.jsp at line 26

23: PersonDAO dao=new PersonDAOImpl();
24: //try
25: //{
26: dao.insert(person);
27: //dao.update(person);
28: //Person per=dao.queryById("MLDN");
29:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
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.Exception: 操作出现异常
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840)
org.apache.jsp.dao.daodemo01_jsp._jspService(daodemo01_jsp.java:105)
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.Exception: 操作出现异常
cn.mldn.lxh.dao.impl.PersonDAOImpl.insert(PersonDAOImpl.java:35)
org.apache.jsp.dao.daodemo01_jsp._jspService(daodemo01_jsp.java:90)
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.25 logs.



------解决方案--------------------
cn.mldn.lxh.dao.impl.PersonDAOImpl.insert(PersonDAOImpl.java:35)
看一下这一行。
------解决方案--------------------
throw new Exception("操作出现异常") ;
把这行改成e.printStackTrace();
明显就是try里面出错了。
错误被你隐藏了,在打印看看。
pstmt.close() ;这个放到finally中
检查属性类型是否匹配。

------解决方案--------------------
探讨

我在另一台机子上运行这个程序在sqlplus命令行连接oracle数据库,tomcatIE中JSP文件点不开,关掉命令行后jsp就能点开了,数据插入成功。是数据库被锁不能同时访问[?郁闷啊Quote=引用:]
引用:

引用:
throw new Exception("操作出现异常") ;
把这行改成e.printStackTrac……

我的异常网推荐解决方案:An exception occurre