Spring-batch,ItemReadListener [SQLException:无效状态,Connection对象关闭]

时间:2015-11-02 17:04:42

标签: multithreading spring-batch sybase connection-pooling

我的应用程序是解析和处理一个巨大的文件,并通过调用dao方法来检查sybase数据库中某些attributs的现有。 我们已经使用了那个spring批处理和多线程机制,因此我们在由SQLException引起的ItemReadListener类的afterRead方法中发生了异常:无效状态,Connection对象被关闭。"

org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [select count(*) from USER_SERVICE where user_serv_oidval = ?]; SQL state [HY010]; error code [0]; Invalid state, the Connection object is closed.; nested exception is java.sql.SQLException: Invalid state, the Connection object is closed.
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:660)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:727)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:737)
at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:805)
at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:824)
at com.orange.essentials.dao.impl.ServiceDaoImpl.isExistServiceById(ServiceDaoImpl.java:28)
at com.orange.essentials.services.ItemReadListenerFunctionalValidator.afterRead(ItemReadListenerFunctionalValidator.java:51)
at com.orange.essentials.services.ItemReadListenerFunctionalValidator.afterRead(ItemReadListenerFunctionalValidator.java:1)
at org.springframework.batch.core.listener.CompositeItemReadListener.afterRead(CompositeItemReadListener.java:60)
at org.springframework.batch.core.listener.MulticasterBatchListener.afterRead(MulticasterBatchListener.java:232)
at org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:93)
at org.springframework.batch.core.step.item.SimpleChunkProvider.read(SimpleChunkProvider.java:155)
at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:114)
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:368)
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
at org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:108)
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:69)
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77)
at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:262)
at java.lang.Thread.run(Thread.java:744)

引起:java.sql.SQLException:无效状态,Connection对象关闭。     at net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.java:1714)     at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareStatement(ConnectionJDBC2.java:2435)     在com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:213)     at org.springframework.jdbc.core.JdbcTemplate $ SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1557)     在org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:638)

0 个答案:

没有答案