Hi, Iam getting the following error . Please suggest :
2010-02-19 14:20:19,234 WARN - SessionImpl.finalize(3396) | unclosed connection com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888) at com.mysql.jdbc.Statement.checkClosed(Statement.java:385) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1361) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1467) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76) at org.ariose.dao.hibernate.ServiceLogDAOHibernate.getServiceData(ServiceLogDAOHibernate.java:37) at org.ariose.service.impl.ServiceLogManagerImpl.getServiceData(ServiceLogManagerImpl.java:25) at org.ariose.web.ServiceLogController.getServiceData(ServiceLogController.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:472) at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:409) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:874) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:808) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 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:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source)
Here's the code : ----------------------- public List<ServiceLogBean> getServiceData(List<String> contents) { List<ServiceLogBean> list=new ArrayList<ServiceLogBean>(); PreparedStatement statement=null; ResultSet resultSet=null; Connection connection=null; try { ServiceLogBean logBean=null; connection=getHibernateTemplate().getSessionFactory().openSession().connection(); for(String content:contents){ String query="select max(execute_time),count(execute_flag),(SELECT COUNT(1) FROM "+content+"_content ) as sCount" + " from "+content+"_content where execute_flag=1; "; System.out.println("Query:"+query); statement=connection.prepareStatement(query); resultSet=statement.executeQuery(); logBean=new ServiceLogBean(); while(resultSet.next()){ if(resultSet.getString(1)!=null) logBean.setLastExecuteTime(resultSet.getString(1).substring(0,resultSet.getString(1).length()-2)); logBean.setRecordsSent(resultSet.getInt(2)); logBean.setTotalRecords(resultSet.getInt(3)); logBean.setRecordsInQueue(resultSet.getInt(3)-resultSet.getInt(2)); logBean.setServiceName(content); } list.add(logBean); resultSet.close(); statement.close(); } System.out.println(list); } catch (Exception e) { e.printStackTrace(); } return list; }
Please help...
|