I am configuring a job with two step, Both step need to read different file and dump the data to database. When I am launching the job it executed the first step and save the data successfully and second step is not reading the file. But in database I can see that both Step Status is successful. My Configuration is looks like:
job id="job1" job-repository="jobRepository" xmlns="http://www.springframework.org/schema/batch" restartable="true">
<step id="step1">
<tasklet transaction-manager="transactionManager" task-executor="taskExecutor">
<chunk reader="DomainItemReader" writer="DomainItemWriter" commit-interval="40" skip-limit="10">
<skippable-exception-classes>
<include class="java.lang.Exception"/>
<exclude class="java.io.FileNotFoundException"/>
</skippable-exception-classes>
<listeners>
<listener ref="MyListener"/>
</listeners>
</chunk>
</tasklet>
<next on="COMPLETED" to="step2"/>
</step>
<step id="step2" >
<tasklet transaction-manager="transactionManager" task-executor="taskExecutor" allow-start-if-complete="true">
<chunk reader="DomainItemReader2" writer="DomainItemWriter2" commit-interval="100" skip-limit="10">
<skippable-exception-classes>
<include class="java.lang.Exception"/>
<exclude class="java.io.FileNotFoundException"/>
</skippable-exception-classes>
<listeners>
<listener ref="MyListener2"/>
</listeners>
</chunk>
</tasklet>
</step>
</job>
And my reader is looks like :
<bean id="billDomainItemReader" class="org.springframework.batch.item.file.FlatFileItemReader">
<property name="resource" value="file:./firstfile.txt" />
<property name="linesToSkip" value="1" />
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<property name="lineTokenizer">
<bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<property name="delimiter">
<util:constant static-field="org.springframework.batch.item.file.transform.DelimitedLineTokenizer.DELIMITER_TAB"/>
</property>
</bean>
</property>
<property name="fieldSetMapper">
<bean class="com.abc.DomainMapper">
<property name="accessJobParam" ref="accessJobParam"/>
</bean>
</property>
</bean>
</property>
</bean>
And my second step's reader is looks like :
<bean id="DomainItemReader2" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">
<property name="resource" value="file:./secondFile.txt" />
<property name="linesToSkip" value="1" />
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<property name="lineTokenizer">
<bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<!-- <property name="names" value="PRODUCT_ID,NAME,DESCRIPTION,PRICE" />-->
<property name="delimiter">
<util:constant static-field="org.springframework.batch.item.file.transform.DelimitedLineTokenizer.DELIMITER_TAB"/>
</property>
</bean>
</property>
<property name="fieldSetMapper">
<bean class="com.abc.DomainMapper2">
<property name="accessJobParam" ref="accessJobParam"/>
</bean>
</property>
</bean>
</property>
</bean>
Can any body please tell me where I am doing wrong and why it is not processing my second step file. Thanks