amdev February 2016

How to get the SQL error origin of an UnexpectedRollbackException

I have a rollback exception with hibernate on my service "duplicateContract"

Caused by: org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException
    at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1031)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy128.duplicateContracts(Unknown Source)
    at com.test.server.rpc.SrvContractImpl.duplicateContracts(SrvContractImpl.java:699)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
    ... 34 more
Caused by: javax.transaction.RollbackException
    at org.objectweb.jotm.TransactionImpl.commit(TransactionImpl.java:329)
    at org.objectweb.jotm.Current.commit(Current.java:485)
    at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1028)
    ... 47 more

T

Answers


Vlad Mihalcea February 2016

I checked the JOTM source code and, to my surprise, they don't propagate the original exception.

try {
    propagateCtx = false;
    term.commit(true);
    propagateCtx = true;
} catch (TransactionRolledbackException e) {
    Current.getCurrent().forgetTx(getXid());
    if (TraceTm.jta.isDebugEnabled()) {
        TraceTm.jta.debug("Commit distributed transaction -> rolled back!");
    }
    localstatus = Status.STATUS_ROLLEDBACK;
    throw new RollbackException();
} 
...

The JOTM project development seems to have stopped (last two releases adate back to 2006 and 2010), so you should better check Narayana, Atomikos or Bitronix.

Post Status

Asked in February 2016
Viewed 2,615 times
Voted 10
Answered 1 times

Search




Leave an answer