Announcement Announcement Module
Collapse
No announcement yet.
Inheritance problem with 2.1.7-RELEASE Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inheritance problem with 2.1.7-RELEASE

    Hello,

    I just tried the 2.1.7-RELEASE and my jobs don't run anymore.
    After going back to 2.1.6-RELEASE they worked again.

    Before I create a JIRA Ticket I need to know if there is an error in my configuration, or if I am missing something....



    The problem seems to be in the job definition, with 2.1.7 a more restrictive check for skip/retry limit and the exceptions classes is in place which is okay but somehow my configuration doesn't work. I'm assuming there might be a problem in the inheritance of step settings.

    This example doesn't work for me:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:batch="http://www.springframework.org/schema/batch"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/batch
            http://www.springframework.org/schema/batch/spring-batch-2.1.xsd>
    
      <bean id="myReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">
        <property name="resource" value="file:/#{jobParameters['FILENAME']}" />
        <property name="linesToSkip" value="1" />
        <property name="strict" value="true" />
        <property name="saveState" value="true" />
        <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" value=";" />
                <property name="names" value="f1,f2" />
                <property name="strict" value="true" />
              </bean>
            </property>
          </bean>
        </property>
      </bean>
    
      <batch:step id="abstractStep" abstract="true">
        <batch:tasklet>
          <batch:chunk skip-limit="20">
            <batch:skippable-exception-classes>
                <batch:include class="java.lang.Exception"/>
            </batch:skippable-exception-classes>
          </batch:chunk>
        </batch:tasklet>
      </batch:step>
    
      <batch:job id="myJob">
        <batch:step id="myStep" parent="abstractStep">
          <batch:tasklet>
            <batch:chunk reader="myReader" />
          </batch:tasklet>
        </batch:step>
      </batch:job>
    </beans>
    When trying to load the spring application context the following error is given:
    The field 'skip-limit' is not permitted on the step [myStep] because there is no 'skippable-exception-classes'.

    As I have multiple jobs depending on the abstract step, having the "skippable-exception-classes" in every job is not a solution.

    Is this a bug or did I miss something?

    Best wishes,
    Robin
    Last edited by robinkrom; Apr 26th, 2011, 12:05 PM. Reason: Typo fix

  • #2
    That looks like an unexpected side effect of https://jira.springsource.org/browse/BATCH-1396. So it's a bug. Go ahead and raise a ticket in JIRA. The only workaround I can think of is to specify the exceptions in every step where they are needed.

    Comment


    • #3
      There is a workaround, I think. You need an empty skippable-exceptions map in all your child steps, e.g.

      Code:
      <job id="myJob">
          <step id="myStep" parent="abstractStep">
            <tasklet>
              <chunk reader="myReader">
                <skippable-exception-classes merge="true"/>
              </chunk>
            </tasklet>
          </step>
        </job>
      Does that work?

      Comment


      • #4
        Workaround

        Hello Dave,

        your suggestion seems to work, although it's a bit hard to guarantee that internally everything works as it should be.

        And it sure is a better workaround as copying all the exception classes! Thanks!

        Still I'm staying on 2.1.6 for now, and I will create a jira ticket directly after posting this.

        Best wishes,
        Robin

        Comment

        Working...
        X