Announcement Announcement Module
Collapse
No announcement yet.
Exception in reader. Not skipping. job failed Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception in reader. Not skipping. job failed

    I have a job def like follows:

    <property name="itemReader">
    <bean class="com.MyReader">
    <property name="itemReader" ref="headerItemReader" />
    <property name="manager" ref="myManager" />
    </bean>
    </property>

    <bean id="headerItemReader" class="org.springframework.batch.item.database.Jdb cCursorItemReader">
    <property name="dataSource" ref="dataSource" />
    <property name="mapper">
    <bean class="com.HeaderMapper" />
    </property>
    <property name="sql">
    <value>
    ${QUERY}
    </value>
    </property>
    <property name="saveState" value="false" />
    </bean>

    If any error occur in retrieving records using {QUERY}, job is failed with "unable to initialize the step" as error. Step is configured as a skippable step and it is skipping properly if any error occur in writer.

    I do not want to stop the job because of error in one record, but i want to skip the failed record and continue fetching the next record.

    Can i achieve this by anyway? Please help me.

  • #2
    JdbcCursorItemReader runs the ${QUERY} only once and then iterates over the ResultSet to return individual items. Failing to run the ${QUERY} is therefore not an error in single record, it's an initialization failure that can't be skipped.

    Comment

    Working...
    X