Note: This issue is somehow related to
As we have some integration-tests running on different application-servers, we discovered some differences in the behavior of the jbatch-implementations concerning listeners in case of exceptions:
If an exception occurs during step-processing (Batchlet- as well as Chunk-Steps), then in case of JBeret, the StepListener.afterStep() method is not called, while the JBatch RI included in GlassFish 4 as well as Apache BatchEE do call the method.
This issue has already been discussed in the JBeret issue-tracker:
Following the logic of the ChunkListener.afterChunk() method, I think that the afterStep()-method should not be called in case of exceptions. So I think the BatchEE implementation should be adjusted here. Please refer to the JBeret issue linked above for more details.
I think in case of exceptions, something like a StepListener.onError() method would be a good idea (instead of calling afterStep() ). I have opened a discussion on the jbatch public mailing list for enhancing the error-handling with listeners: