Please let us know if you have any idea regarding the below issue.
The issue is coming after reading and then inserting certain number of records...
I am using DB2, Spring Batch -- Quartz Scheduler and Hibernate..
Below are my hibernate settings..
hibernate.dialect=org.hibernate.dialect.DB2390Dialect
hibernate.show_sql=false
hibernate.connection.pool_size=20
hibernate.jdbc.batch_size=30
optimistic-lock=none
hibernate.connection.release_mode=after_statement
Please let me know if i need to do any modifications in my settings.
Code:
[9/28/11 10:02:40:453 PDT] 00000031 JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions [ibm]
[db2][jcc][t4][2030][11211] A communication error has been detected. Communication protocol being used: TCP/IP.
Communication API being used: SOCKETS. Location where the error was detected: Reply.fill().
Communication function detecting the error: InputStream.read(). Protocol specific error codes Insufficient data, *
, 0. Message: null
[9/28/11 10:02:40:656 PDT] 00000031 AbstractStep E org.springframework.batch.core.step.AbstractStep execute
Encountered an error executing the step
org.hibernate.exception.GenericJDBCException: could not advance using next()
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:127)
at org.springframework.batch.item.database.HibernateCursorItemReader.doRead
(HibernateCursorItemReader.java:154)
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read
(AbstractItemCountingItemStreamItemReader.java:85)
at org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:90)
at org.springframework.batch.core.step.item.SimpleChunkProvider.read(SimpleChunkProvider.java:148)
at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration
(SimpleChunkProvider.java:108)
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214)
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
at org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:103)
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:68)
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction
(TaskletStep.java:371)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:262)
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration
(StepContextRepeatCallback.java:76)
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214)
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:248)
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195)
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135)
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281)
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
at java.lang.Thread.run(Thread.java:736)
Caused by: com.ibm.db2.jcc.c.DisconnectException: [ibm][db2][jcc][t4][2030][11211] A communication error has been
detected. Communication protocol being used: TCP/IP.
Communication API being used: SOCKETS. Location where the error was detected: Reply.fill().
Communication function detecting the error: InputStream.read(). Protocol specific error codes Insufficient data, *
, 0. Message: null
at com.ibm.db2.jcc.b.a.a(a.java:362)
at com.ibm.db2.jcc.b.db.b(db.java:215)
at com.ibm.db2.jcc.b.db.c(db.java:233)
at com.ibm.db2.jcc.b.db.c(db.java:344)
at com.ibm.db2.jcc.b.db.v(db.java:1130)
at com.ibm.db2.jcc.b.hb.c(hb.java:32)
at com.ibm.db2.jcc.b.x.a(x.java:34)
at com.ibm.db2.jcc.b.j.Ib(j.java:257)
at com.ibm.db2.jcc.c.wf.R(wf.java:2805)
at com.ibm.db2.jcc.b.d.f(d.java:1485)
at com.ibm.db2.jcc.c.s.a(s.java:191)
at com.ibm.db2.jcc.c.wf.c(wf.java:267)
at com.ibm.db2.jcc.c.wf.next(wf.java:234)
at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:169)
at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:169)
at org.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:122)
... 28 more
[9/28/11 10:02:40:890 PDT] 00000031 AbstractBatch W org.hibernate.jdbc.AbstractBatcher closeQueryStatement
exception clearing maxRows/queryTimeout
com.ibm.db2.jcc.c.SqlException: [ibm][db2][jcc][10120][10943] Invalid operation:
statement is closed.
at com.ibm.db2.jcc.c.fg.A(fg.java:2329)
at com.ibm.db2.jcc.c.fg.getMaxRows(fg.java:597)
at org.apache.commons.dbcp.DelegatingStatement.getMaxRows(DelegatingStatement.java:237)
at org.apache.commons.dbcp.DelegatingStatement.getMaxRows(DelegatingStatement.java:237)
at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:298)
at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:234)
at org.hibernate.impl.AbstractScrollableResults.close(AbstractScrollableResults.java:122)
at org.springframework.batch.item.database.HibernateCursorItemReader.doClose
(HibernateCursorItemReader.java:223)
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.close
(AbstractItemCountingItemStreamItemReader.java:124)
at org.springframework.batch.item.support.CompositeItemStream.close(CompositeItemStream.java:86)
at org.springframework.batch.core.step.tasklet.TaskletStep.close(TaskletStep.java:285)
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:255)
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135)
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281)
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
at java.lang.Thread.run(Thread.java:736)
[9/28/11 10:02:40:906 PDT] 00000031 JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL
Error: 0, SQLState: null
[9/28/11 10:02:40:906 PDT] 00000031 JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions Already
closed.
[9/28/11 10:02:40:906 PDT] 00000031 JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL
Error: 0, SQLState: null
[9/28/11 10:02:40:906 PDT] 00000031 JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions Already
closed.
[9/28/11 10:02:40:906 PDT] 00000031 AbstractStep E org.springframework.batch.core.step.AbstractStep execute
Exception while closing step execution resources
org.springframework.batch.item.ItemStreamException: Error while closing item
reader
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.close
(AbstractItemCountingItemStreamItemReader.java:127)
at org.springframework.batch.item.support.CompositeItemStream.close(CompositeItemStream.java:86)
at org.springframework.batch.core.step.tasklet.TaskletStep.close(TaskletStep.java:285)
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:255)
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135)
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281)
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
at java.lang.Thread.run(Thread.java:736)
Caused by: org.hibernate.exception.GenericJDBCException: Cannot release connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:478)
at org.hibernate.jdbc.ConnectionManager.cleanup(ConnectionManager.java:408)
at org.hibernate.jdbc.ConnectionManager.close(ConnectionManager.java:347)
at org.hibernate.impl.StatelessSessionImpl.managedClose(StatelessSessionImpl.java:323)
at org.hibernate.impl.StatelessSessionImpl.close(StatelessSessionImpl.java:300)
at org.springframework.batch.item.database.HibernateItemReaderHelper.close
(HibernateItemReaderHelper.java:191)
at org.springframework.batch.item.database.HibernateCursorItemReader.doClose
(HibernateCursorItemReader.java:226)
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.close
(AbstractItemCountingItemStreamItemReader.java:124)
... 12 more
Caused by: java.sql.SQLException: Already closed.
at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:115)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.closeConnection
(LocalDataSourceConnectionProvider.java:95)
at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:474)