Hi, I am trying to use a custom Exit Code ("COMPLETE_WITH_WARN") to control the steps (terminate job) I run in my job, but I get a FlowExecutionException. Any idea what have I done wrong?
I am using SpringBatch-2.1.1-RELEASE.
Here is how the code looks like:
xml (step in restartable job):
aSkipListener.java:Code:<step id="processDomainObject"> <tasklet> <chunk reader="itemreader" processor="itemprocessor" writer="itemwriter" commit-interval="1" skip-limit="1"> <skippable-exception-classes> <include class="a.b.ExceptionToSkip" /> </skippable-exception-classes> </chunk> <listeners> <listener ref="aSkipListener" /> </listeners> </tasklet> <next on="COMPLETED" to="wrapUp" /> <fail on="COMPLETED_WITH_WARN" /> </step>
Code:public ExitStatus afterStep( StepExecution stepExecution ) { ExitStatus exitStatus = stepExecution.getExitStatus(); if ( exitStatus.equals( ExitStatus.COMPLETED ) && stepExecution.getSkipCount() > 0 ) { return new ExitStatus("COMPLETED_WITH_WARN"); } else { return exitStatus; } }
And the exception is:
Code:Caused by: org.springframework.batch.core.job.flow.FlowExecutionException: Next state not found in flow=doStuffStep for state=doStuffStep .processDomainObject with exit status=COMPLETED_WITH_WARN at org.springframework.batch.core.job.flow.support.SimpleFlow.nextState(SimpleFlow.java:195) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:158)


Reply With Quote
