problem with spring batch it dosen't process all records when i have error Partition handler returned an unsuccessful step

Viewed 403

Hello I want your help

I work on a batch with spring Batch but I have a problem . my batch does not process all the records for example I have a file in input which contains 1331 records. my batch only processes 1274.

in the console I have the following error

2022-03-28_22:13:54.038 INFO  o.s.b.core.step.tasklet.TaskletStep - Commit failed while step execution data was already updated. Reverting to old version.
2022-03-28_22:13:54.045 ERROR o.s.batch.core.step.AbstractStep - Encountered an error executing step stepEffectuerSegmentationOP in job jobSegmentationConversionSegmenteOgranismePublic
org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is bitronix.tm.internal.BitronixRollbackException: RuntimeException thrown during beforeCompletion cycle caused transaction rollback


2022-03-28_22:13:54.058 ERROR o.s.batch.core.step.AbstractStep - Encountered an error saving batch meta data for step stepSC in job jobSC. This job is now in an unknown state and should not be restarted.
org.springframework.dao.OptimisticLockingFailureException: Attempt to update step execution id=6 with wrong version (1), where current version is 2


2022-03-28_22:14:02.095 ERROR o.s.batch.core.step.AbstractStep - Encountered an error executing step stepSCMaster in job jobSC
org.springframework.batch.core.JobExecutionException: Partition handler returned an unsuccessful step
        at org.springframework.batch.core.partition.support.PartitionStep.doExecute(PartitionStep.java:111) ~[spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195) ~[spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:141) [spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64) [spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60) [spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:151) [spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:130) [spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135) [spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:301) [spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:134) [spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50) [spring-core-4.1.8.RELEASE.jar:4.1.8.RELEASE]
        at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:127) [spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:351) [spring-batch-core-2.2.7.RELEASE.jar:na]
        at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:577) [spring-batch-core-2.2.7.RELEASE.jar:na]
2022-03-28_22:14:02.095 WARN  bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource
  • I removed line 140 I have the same error but my batch has processed all rows (1330).
  • I executed my batch with only one case (case of line 140)I have the same error but my batch has processed the case.
  • I did another test with other 2660 cases it works.

I don't know why my batch is not processing 1331 . Is there a way to force to process all rows even if I get the error same

org.springframework.batch.core.JobExecutionException: Partition handler returned an unsuccessful step

here is part of my job

<bean id="taskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor">
    <property name="concurrencyLimit" value="20"/>
</bean>



  <batch:step id="stepSCMaster">
            <batch:partition step="stepSC" partitioner="partionneur">
                <batch:handler grid-size="20" task-executor="taskExecutor" />
            </batch:partition>

            <batch:next on="*" to="stepSCOutput" />

        </batch:step>

        <batch:step id="stepSCOutput" parent="parentExecutionStep">
            <batch:tasklet>
                <batch:chunk reader="readerSC" writer="compositeWriter" />
            </batch:tasklet>

        </batch:step>

    </batch:job>

    <batch:step id="stepSC" parent="parentExecutionStep">
        <batch:tasklet>
            <batch:transaction-attributes isolation="READ_COMMITTED" propagation="REQUIRES_NEW" timeout="3600"/>
            <batch:chunk reader="readerInputPartition"
                         processor="traitementSC"
                         writer="writerMockItem"
                         commit-interval="20">
            </batch:chunk>

            <batch:listeners merge="true">
                <batch:listener ref="traitementSC"/>
            </batch:listeners>

        </batch:tasklet>
    </batch:step>

Thank you.

0 Answers
Related