-
Nov 9th, 2012, 01:16 AM
#1
JdbcCursorItemReader throw Result set already closed - Issue
I have retrive the data from data base and process the record using spring batch.I use the JdbcCursorItemReader and set commit-level is 5 so it fetch first 5 records and commit sucessfully while fetch second time getting
org.springframework.jdbc.UncategorizedSQLException : Attempt to process next row failed; uncategorized SQLException for SQL [
select UID,age from Test WHERE FIRST_CLOSED_DATE is null order by uid desc
]; SQL state [null]; error code [0]; Result set already closed; nested exception is java.sql.SQLException: Result set already closed
Please let me know if any configuration has been issue or any additional implemantion is required in reader and writer
<batch:job id="ageOpenAuth" job-repository="jobRepository"
incrementer="incrementJobParameters" restartable="true">
<batch:step id="ageOpenAuthBatch">
<batch:tasklet>
<batch:transaction-attributes
isolation="DEFAULT" propagation="REQUIRED" timeout="240" />
<batch:chunk reader="ageOpenAuthRequestReader" writer="ageOpenAuthRequestWriter"
commit-interval="5">
</batch:chunk>
</batch:tasklet>
</batch:step>
</batch:job>
<bean id="incrementJobParameters"
class="com.service.rls.utils.IncrementJobParameter s" />
<aop:config>
<aop:advisor advice-ref="txAdvice"
pointcut="execution(*
org.springframework.batch.core..*Repository+.*(..) )" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<bean id="ageOpenAuthRequestReader" class="org.springframework.batch.item.database.Jdb cCursorItemReader"
>
<property name="rowMapper" ref="ageOpenAuthRequestFieldMapper" />
<property name="dataSource" ref="mmsDataSource" />
<property name="sql" >
<value>
<![CDATA[
select UID,age from Test WHERE FIRST_CLOSED_DATE is null order by uid desc
]]>
</value>
</property>
</bean>
<bean id="ageOpenAuthRequestFieldMapper"
class="com.service.rls.utils.AgeOpenAuthRequestFie ldMapper" />
<bean id="ageOpenAuthRequestWriter"
class="com.service.rls.utils.AgeOpenAuthRequestWri ter"
/>
org.springframework.batch.core.step.AbstractStep - Encountered an error executing the step
org.springframework.jdbc.UncategorizedSQLException : Attempt to process next row failed; uncategorized SQLException for SQL [
select UID,age from Test WHERE FIRST_CLOSED_DATE is null order by uid desc
]; SQL state [null]; error code [0]; Result set already closed; nested exception is java.sql.SQLException: Result set already closed
at org.springframework.jdbc.support.AbstractFallbackS QLExceptionTranslator.translate(AbstractFallbackSQ LExceptionTranslator.java:83) ~[spring-full.jar:3.0.5]
at org.springframework.jdbc.support.AbstractFallbackS QLExceptionTranslator.translate(AbstractFallbackSQ LExceptionTranslator.java:80) ~[spring-full.jar:3.0.5]
at org.springframework.jdbc.support.AbstractFallbackS QLExceptionTranslator.translate(AbstractFallbackSQ LExceptionTranslator.java:80) ~[spring-full.jar:3.0.5]
at org.springframework.batch.item.database.AbstractCu rsorItemReader.doRead(AbstractCursorItemReader.jav a:450) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.item.support.AbstractIte mCountingItemStreamItemReader.read(AbstractItemCou ntingItemStreamItemReader.java:85) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.step.item.SimpleChu nkProvider.doRead(SimpleChunkProvider.java:90) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.step.item.SimpleChu nkProvider.read(SimpleChunkProvider.java:148) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.step.item.SimpleChu nkProvider$1.doInIteration(SimpleChunkProvider.jav a:108) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:367) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:214) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.step.item.SimpleChu nkProvider.provide(SimpleChunkProvider.java:103) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.step.item.ChunkOrie ntedTasklet.execute(ChunkOrientedTasklet.java:68) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.step.tasklet.Taskle tStep$ChunkTransactionCallback.doInTransaction(Tas kletStep.java:386) ~[spring-batch-full.jar:2.1.8]
at org.springframework.transaction.support.Transactio nTemplate.execute(TransactionTemplate.java:130) ~[spring-full.jar:3.0.5]
at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:264) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:76) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:367) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:214) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.step.tasklet.Taskle tStep.doExecute(TaskletStep.java:250) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:195) ~[spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.job.SimpleStepHandl er.handleStep(SimpleStepHandler.java:135) [spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.job.flow.JobFlowExe cutor.executeStep(JobFlowExecutor.java:61) [spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.job.flow.support.st ate.StepState.handle(StepState.java:60) [spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:144) [spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.job.flow.support.Si mpleFlow.start(SimpleFlow.java:124) [spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:135) [spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:281) [spring-batch-full.jar:2.1.8]
at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:120) [spring-batch-full.jar:2.1.8]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_29]
Caused by: java.sql.SQLException: Result set already closed
at weblogic.jdbc.wrapper.ResultSet.checkResultSet(Res ultSet.java:144) ~[com.bea.core.datasource6_1.9.0.0.jar:1.9.0.0]
at weblogic.jdbc.wrapper.ResultSet.preInvocationHandl er(ResultSet.java:97) ~[com.bea.core.datasource6_1.9.0.0.jar:1.9.0.0]
at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver _OracleResultSetImpl.next(Unknown Source) ~[com.bea.core.utils.wrapper_1.4.0.0.jar:1.9.0.0]
at org.springframework.batch.item.database.AbstractCu rsorItemReader.doRead(AbstractCursorItemReader.jav a:441) ~[spring-batch-full.jar:2.1.8]
Last edited by Rameshravi; Nov 9th, 2012 at 08:04 PM.
Reason: missing the context
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules