Results 1 to 6 of 6

Thread: no 'retryable-exception-classes' when inherit from parentStep

  1. #1
    Join Date
    Jan 2012
    Posts
    11

    Question 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. #2
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    351

    Default

    Are you getting that error on startup or when the exception occurs?
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

  3. #3
    Join Date
    Jan 2012
    Posts
    11

    Default

    Hi,
    It is on start up.

  4. #4
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    351

    Default

    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>
    ...
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

  5. #5
    Join Date
    Jan 2012
    Posts
    11

    Default

    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.

  6. #6
    Join Date
    Sep 2012
    Posts
    1

    Default

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

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

    in the child steps.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •