diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java index 794c58a08..7982f192b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java @@ -296,12 +296,24 @@ public class TaskletStep extends AbstractStep { } catch (Error e) { - processRollback(stepExecution, fatalException, transaction); - throw e; + try { + processRollback(stepExecution, fatalException, transaction); + throw e; + } + catch (Exception rollbackException) { + logger.error("Rollback failed, original error that caused the rollback is", e); + throw rollbackException; + } } catch (Exception e) { - processRollback(stepExecution, fatalException, transaction); - throw e; + try { + processRollback(stepExecution, fatalException, transaction); + throw e; + } + catch (Exception rollbackException) { + logger.error("Rollback failed, original exception that caused the rollback is", e); + throw rollbackException; + } } finally { // only release the lock if we acquired it @@ -349,6 +361,9 @@ public class TaskletStep extends AbstractStep { fatalException.setException(e); throw new FatalException("Failed while processing rollback", e); } + else { + logger.error("Failed to rollback transaction", e); + } } if (fatalException.hasException()) {