Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception on batch processing UnexpectedRollbackException - Transaction rolled back

Tags:

java

spring

I am getting the below exception when doing a batch processing

encountered an error.org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
    at java.util.concurrent.FutureTask.get(FutureTask.java:111)

Could someone help me with what might be the issue?

Thanks.

like image 611
Kathir Avatar asked Dec 15 '22 05:12

Kathir


1 Answers

Probably you have a checked exception somewhere in one of your beans that you catch in another one, but the transaction advice of spring notices it and will mark the transaction for rollback.

You can play with the noRollBackFor property of the Transactional annotation.

like image 169
devnoo Avatar answered Jan 04 '23 23:01

devnoo