Hi,
i have a job configured with a step to read from the DB using JdbcCursorItemReader. The first time the job is run on application startup, it runs fine. However on second execution and furthur executions it fails with the error
Code:java.lang.IllegalArgumentException: [Assertion failed] - the object argument must be null at org.springframework.util.Assert.isNull(Assert.java:89) at org.springframework.util.Assert.isNull(Assert.java:100) at org.springframework.batch.item.database.JdbcCursorItemReader.open(JdbcCursorItemReader.java:324) at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:105) at org.springframework.batch.core.step.item.ItemOrientedStep.execute(ItemOrientedStep.java:264)
Job configuration is as shown:
I read about the JdbcCursorItemReader.close() method, but how or when should the same be invoked? Please guide me on the sameCode:<bean id="simpleJob" class="org.springframework.batch.core.job.SimpleJob" abstract="true" scope="prototype"> <property name="jobRepository" ref="jobRepository"/> <property name="restartable" value="true"/> </bean> <bean id="simpleStep" class="org.springframework.batch.core.step.item.SimpleStepFactoryBean" abstract="true" scope="prototype"> <property name="transactionManager" ref="transactionManager"/> <property name="jobRepository" ref="jobRepository"/> </bean> <bean id="jdbcCursorItemReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" abstract="true" scope="prototype"> <property name="dataSource" ref="dataSource"/> </bean> <bean id="eodJob" parent="simpleJob"> <property name="name" value="EOD_Job"/> <property name="steps"> <list> <bean id="EODTransactionProcessing" parent="simpleStep"> <property name="itemReader"> <bean parent="jdbcCursorItemReader"> <property name="sql" value="SELECT * FROM TEMP_TX"/> <property name="mapper" ref="transactionMapper"/> </bean> </property> <property name="itemWriter" ref="transactionWriter"/> </bean> </list> </property> </bean>


Reply With Quote