org.springframework.jdbc.UncategorizedSQLException: (SqlMapClient operation): encountered SQLException [  
--- The error occurred in com/unc/dao/ibatis/maps/SmscList.xml.  
--- The error occurred while applying a parameter map.  
--- Check the selectSmscListClassName-InlineParameterMap.  
--- Check the statement (query failed).  
--- Cause: java.sql.SQLException: 关闭的连接]; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in com/unc/dao/ibatis/maps/SmscList.xml.  
--- The error occurred while applying a parameter map.  
--- Check the selectSmscListClassName-InlineParameterMap.  
--- Check the statement (query failed).  
--- Cause: java.sql.SQLException: 关闭的连接 
com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in com/unc/dao/ibatis/maps/SmscList.xml.  
--- The error occurred while applying a parameter map.  
--- Check the selectSmscListClassName-InlineParameterMap.  
--- Check the statement (query failed).  
--- Cause: java.sql.SQLException: 关闭的连接 
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185) 
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123) 
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615) 
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589) 
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) 
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95) 
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:245) 
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:165) 
at org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:204) 
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:243) 
at com.unc.dao.ibatis.SqlMapSmscListDAO.selectSmscListClassName(SqlMapSmscListDAO.java:54) 
at com.unc.services.imp.ListServiceImpl.selectSmscListClassName(ListServiceImpl.java:78) 
at com.unc.timing.TimingTask.getSendMessage(TimingTask.java:98) 
at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:585) 
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:222) 
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:165) 
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:66) 
at org.quartz.core.JobRunShell.run(JobRunShell.java:191) 
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516) 
Caused by: java.sql.SQLException: 关闭的连接 
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111) 
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145) 
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:207) 
at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:3520) 
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3265) 
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3389) 
at com.caucho.sql.UserPreparedStatement.execute(UserPreparedStatement.java:126) 
at com.caucho.sql.UserPreparedStatement.execute(UserPreparedStatement.java:126) 
at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:585) 
at com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:62) 
at $Proxy3.execute(Unknown Source) 
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:186) 
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205) 
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173) 
... 20 more 程序设计的是每隔5秒执行一次任务,每个任务会分发线程去执行,个人分析是在每个线程执行的时候脱离了spring的管理,所以每个线程都没有自己关闭数据源.请问应该怎么关闭ibatis的getSqlMapClientTemplate()方法的连接,也就是手动关闭连接。

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【YippeeYang】截止到2008-06-30 14:10:40的历史汇总数据(不包括此帖):
    发帖数:9                  发帖分:195                
    结贴数:5                  结贴分:40                 
    未结数:4                  未结分:155                
    结贴率:55.56 %            结分率:20.51 %            
    楼主加油