This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Exception in Spring Batch is causing rollback

Nov 26th, 2012, 10:26 AM

I am processing the records from CSV and if I get an exeption the entire transaction is getting rolledback.
I have used skip and no roll back both are not working.
ERROR 2012-11-20 09:48:58,626 org.springframework.batch.core.step.AbstractStep - Encountered an error executing the step
org.springframework.transaction.UnexpectedRollback Exception: Transaction rolled back because it has been marked as rollback-only
at org.springframework.transaction.support.AbstractPl atformTransactionManager.commit(AbstractPlatformTr ansactionManager.java:717)
at org.springframework.transaction.support.Transactio nTemplate.execute(TransactionTemplate.java:147)
at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:263)
at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:76)
at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:367)
at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:214)
at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143)
at org.springframework.batch.core.step.tasklet.Taskle tStep.doExecute(TaskletStep.java:248)
at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:195)
at org.springframework.batch.core.job.SimpleStepHandl er.handleStep(SimpleStepHandler.java:135)
at org.springframework.batch.core.job.flow.JobFlowExe cutor.executeStep(JobFlowExecutor.java:61)
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:135)
at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:281)
at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:120)
at org.springframework.core.task.SyncTaskExecutor.exe cute(SyncTaskExecutor.java:48)
at org.springframework.batch.core.launch.support.Simp leJobLauncher.run(SimpleJobLauncher.java:114)
at org.springframework.batch.core.launch.support.Comm andLineJobRunner.start(CommandLineJobRunner.java:3 48)
at org.springframework.batch.core.launch.support.Comm andLineJobRunner.main(CommandLineJobRunner.java:56 5)