Announcement Announcement Module
No announcement yet.
Spring Batch SkipListener not called when exception occurs in Writer Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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">


    Please suggest if i missed out any configurations....
    Last edited by Eswar2011; Dec 13th, 2011, 03:48 AM.

  • #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">
    <chunk reader="fileItemReader" processor="tradeProcessor" writer="tradeWriter" commit-interval="3" skip-limit="10">
    <include class="org.springframework.batch.item.file.FlatFil eParseException" />
    <include class="org.springframework.batch.item.WriteFailedE xception" />


    <next on="*" to="step2" />
    <next on="COMPLETED WITH SKIPS" to="errorPrint1" />
    <fail on="FAILED" exit-code="FAILED" />

    @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,