Results 1 to 5 of 5

Thread: Rollback exception

  1. #1
    Join Date
    Jun 2009
    Posts
    23

    Default 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. #2
    Join Date
    Apr 2008
    Location
    Philadelphia, US
    Posts
    198

    Arrow

    @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.
    Humans are stateful and mutable beings that have no problems processing many things concurrently and share state with others + they are usually "coupled"

  3. #3

    Default

    Quote 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
    I love my mustang with my magnaflow exhaust and magnaflow catalytic converter

  4. #4
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    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.

  5. #5
    Join Date
    Jun 2009
    Posts
    23

    Default

    Thanks for help Dave. It worked

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •