1

I'm getting this error instead of my custom exception when a ConstraintViolationException occurs during POST operation. This occurs when my spring boot project is deployed in the WebLogic Server.

Here is the full error

JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion: sync=org.hibernate.resource.transaction.backend.jta.internal.synchronization.RegisteredSynchronization@74a8e6a3\r\norg.hibernate.exception.ConstraintViolationException: could not execute batch"

From this post UnexpectedRollbackException - JTA transaction unexpectedly rolled back I know it is due to Hibernate adding it's own wrapper to my custom exception. But I couldn't find a way to prevent this. Also I tried changing the JTA transaction timeout. None of it worked.

This is how I catch the DataIntegrityViolationException

catch (DataIntegrityViolationException | PersistenceException ex) {
            throw new AccountValidationException(Markers.ACC_SER_ADD_2.toString(), "Account Number should be unique");
        }

Any workaround for this?? Thanks in advance

Adarsh D
  • 511
  • 6
  • 14

0 Answers0