How to get original SQL error from UnexpectedRollbackException

I have a rollback exception with hibernate in my duplicateContract service

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

The problem is that I just cannot debug this, there is an error with the stored object somewhere, but I have no hint (this is not a timeout or @Transactional is missing). How can I get more details about this exception? (maybe somewhere in the oracle journal, but where?).

+4
source share
1 answer

I checked the JOTM source code and, to my surprise, they do not 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();
} 
...

JOTM , ( 2006 2010 ), Narayana, Atomikos Bitronix.

+2

Source: https://habr.com/ru/post/1627779/


All Articles