Announcement Announcement Module
Collapse
No announcement yet.
Rollback exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rollback exception

    Hello,

    Can some help me to find the actual cause of the following error.

    Stack trace is as follows:


    02-Nov-09 16:21: PM. ERROR TaskletStep.doInChunkContext :314 - Rollback caused by fatal failure failed
    org.springframework.transaction.IllegalTransaction StateException: Transaction is already completed - do not call commit or rollback more than once per transaction
    at org.springframework.transaction.support.AbstractPl atformTransactionManager.rollback(AbstractPlatform TransactionManager.java:772)
    at org.springframework.batch.core.step.tasklet.Taskle tStep.rollback(TaskletStep.java:368)
    at org.springframework.batch.core.step.tasklet.Taskle tStep.access$1000(TaskletStep.java:68)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:309)
    at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:67)
    at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:352)
    at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:212)
    at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143)
    at org.springframework.batch.core.step.tasklet.Taskle tStep.doExecute(TaskletStep.java:239)
    at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:197)
    at org.springframework.batch.core.job.AbstractJob.han dleStep(AbstractJob.java:348)
    at org.springframework.batch.core.job.flow.FlowJob.ac cess$100(FlowJob.java:43)
    at org.springframework.batch.core.job.flow.FlowJob$Jo bFlowExecutor.executeStep(FlowJob.java:137)
    at org.springframework.batch.core.job.flow.support.st ate.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:144)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:105)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:250)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:110)
    at org.springframework.core.task.SyncTaskExecutor.exe cute(SyncTaskExecutor.java:49)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher.run(SimpleJobLauncher.java:105)
    at com.ussco.batch.util.CtsJobLauncher.start(CtsJobLa uncher.java:251)
    at com.ussco.batch.util.CtsJobLauncher.main(CtsJobLau ncher.java:306)

  • #2
    @springilu,

    The exception is pretty explicit: "Transaction is already completed - do not call commit or rollback more than once per transaction".

    This could happen in a couple of cases:

    1. You manually get a reference to transaction and commit it before the end of the step (where framework commits it)

    2. Your job is multi-threaded and you are using MapJobRepositoryFactoryBean "that automates the creation of a SimpleJobRepository using non-persistent in-memory DAO implementations", and not suited to handle multi-threaded jobs.

    Comment


    • #3
      Originally posted by litius View Post
      @springilu,

      The exception is pretty explicit: "Transaction is already completed - do not call commit or rollback more than once per transaction".

      This could happen in a couple of cases:

      1. You manually get a reference to transaction and commit it before the end of the step (where framework commits it)

      2. Your job is multi-threaded and you are using MapJobRepositoryFactoryBean "that automates the creation of a SimpleJobRepository using non-persistent in-memory DAO implementations", and not suited to handle multi-threaded jobs.
      I agree use the error to lead you in the trouble shooting

      Comment


      • #4
        A transaction failure can occur if you use an ORM like Hibernate and leave the flush mode to automatic (the flush happens on transaction comit so Batch can't tell the different between that and a resource failure). If that is what you are doing you should flush() manually in your ItemWriter so that the error happens in the body of the transaction.

        Comment


        • #5
          Thanks for help Dave. It worked

          Comment

          Working...
          X