java.sql.SQLException: org.apache.tomcat.dbcp.dbcp.DelegatingStatement……解决方法

java.sql.SQLException: org.apache.tomcat.dbcp.dbcp.DelegatingStatement with address: "com.mysql.jdbc.StatementImpl@187955b" is closed.

at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.checkOpen(DelegatingStatement.java:137)

at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)

at com.goodsshop.db.DB.insertMeg(DB.java:84)

at com.goodsshop.servlet.RegisterLogin.doRegister(RegisterLogin.java:116)

at com.goodsshop.servlet.RegisterLogin.doPost(RegisterLogin.java:37)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)

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:128)

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:286)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(Thread.java:619)

 

 

 

分析问题:

这个错误也没有什么的,看到我注明的红色Word了吗?意思就是你调用了一个业务逻辑方法后关闭了Statement,而在同一个对象同要调用了另一个业务逻辑方法,这时的Statement已经被关闭释放了,所以就出现了前面的异常啦!!!!!!!!!!


你可能感兴趣的:(java,apache,sql,tomcat,servlet)