Announcement Announcement Module
Collapse
No announcement yet.
no 'retryable-exception-classes' when inherit from parentStep Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • no 'retryable-exception-classes' when inherit from parentStep

    Hi, I am having this parentStep:

    Code:
    <batch:step id="masterStep" abstract="true">
            <batch:tasklet>
                <batch:chunk retry-limit="3" processor="dummyProcessor" writer="dummyWriter">
                    <batch:retryable-exception-classes>
                        <batch:include class="org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException"/>
                        <batch:include class="org.springframework.dao.CannotAcquireLockException"/>
                        <batch:include class="org.springframework.dao.OptimisticLockingFailureException"/>
                        <batch:include class="org.hibernate.StaleObjectStateException"/>
                    </batch:retryable-exception-classes>
                </batch:chunk>
            </batch:tasklet>
        </batch:step>
    Then I declare another step that inherit it:
    Code:
        <batch:job id="ChildJob">
            <batch:step id="ChildStep1" parent="masterStep">
                <batch:tasklet>
                    <batch:chunk commit-interval="3" reader="reader">
                    </batch:chunk>
                </batch:tasklet>
            </batch:step>
        </batch:job>
    I expect the retryable ex. class list will be inherited as well. But I encountered the error:

    the field 'retry-limit' is not permitted on the step [TopicArticlesStep1] because there is no 'retryable-exception-classes'
    I found out that if I put the 'retry-limit' attribute on the ChildStep1 like this:

    Code:
    <batch:chunk commit-interval="3" reader="reader" retry-limit=3>
                    </batch:chunk>
    The error goes away.

    Is it a bug ?

    Or is it the expected way I need to declare the exception list with a merge="true" in the child step ? :

    Code:
    <batch:chunk commit-interval="3" reader="reader">
    <batch:retryable-exception-classes merge="true">
                    </batch:retryable-exception-classes>
                    </batch:chunk>
    Thanks.

  • #2
    Are you getting that error on startup or when the exception occurs?

    Comment


    • #3
      Hi,
      It is on start up.

      Comment


      • #4
        The reason I ask is because, when I launch the following job, I don't get any errors (however, the exception case is never triggered in this example). What version of Spring Batch are you using?

        Code:
        ...
        	<step id="formatFileStep" xmlns="http://www.springframework.org/schema/batch">
        		<tasklet>
        			<chunk reader="customerFileReader" writer="xmlOutputWriter"
        				commit-interval="10" retry-limit="3">
        				<retryable-exception-classes>
        					<include class="java.lang.NullPointerException"/>
        				</retryable-exception-classes>
        			</chunk>
        		</tasklet>
        	</step>
        
        	<job id="restart.job1" xmlns="http://www.springframework.org/schema/batch">
        		<step id="job1.step1" next="job1.step2" parent="formatFileStep"/>
        		<step id="job1.step2">
        			<tasklet allow-start-if-complete="true" >
        				<chunk reader="failureReader" writer="xmlOutputWriter"
        					commit-interval="10" />
        			</tasklet>
        		</step>
        	</job>
        ...

        Comment


        • #5
          Hi,
          Thanks for looking at it.
          The case I am having error is different in that it declare "parentStep" as abstract with default processor and writer. The child step declare a reader without overriding the processor and writer.

          Comment


          • #6
            I've just had the same issue - I've solved it by including:

            <batch:retryable-exception-classes merge="true"/>

            in the child steps.

            Comment

            Working...
            X