-
Dec 13th, 2011, 02:11 AM
#1
Spring Batch SkipListener not called when exception occurs in Writer
My skip listener onSkipInRead() and onSkipInProcess()methods are called properly, But onSkipInWrite() is not getting called. I found this by throwing a run time exception from my writer.
My Step Configuration
----------------------
<bean id="testFactory" class="testFactory" abstract="true">
<property name="transactionManager" ref="transactionManager" />
<property name="commitInterval" value="10" />
<property name="skipLimit" value="10" />
<property name="jobRepository" ref="jobRepository"></property>
<property name="skippableExceptionClasses">
<util:map map-class="java.util.HashMap">
<entry key="java.lang.Exception">
<value>true</value>
</entry>
</util:map>
</property>
</bean>
Please suggest if i missed out any configurations....
Last edited by Eswar2011; Dec 13th, 2011 at 03:48 AM.
-
Dec 13th, 2011, 12:10 PM
#2
I just executed the example from our spring-batch-samples:src/test/java/... SkipSampleFunctionalTests, which is passing the unit test. The configuration file is skipSampleJob.xml and has the following:
<step id="step1" parent="baseStep">
<tasklet>
<chunk reader="fileItemReader" processor="tradeProcessor" writer="tradeWriter" commit-interval="3" skip-limit="10">
<skippable-exception-classes>
<include class="org.springframework.batch.item.file.FlatFil eParseException" />
<include class="org.springframework.batch.item.WriteFailedE xception" />
</skippable-exception-classes>
</chunk>
</tasklet>
<next on="*" to="step2" />
<next on="COMPLETED WITH SKIPS" to="errorPrint1" />
<fail on="FAILED" exit-code="FAILED" />
</step>
@OnSkipInWrite is getting invoked correctly in both the unit test and samples functional tests. Can you compare with those and see if there's a difference?
Hope that helps,
Wayne
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