我的服务“duplicateContract”上有hibernate的回滚异常
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
问题是,我只是无法调试,在某处有持久对象的错误,但我没有线索(它不是超时或缺少@Transactional).如何获得此异常的更多详细信息? (也许在oracle日志的某个地方?但在哪里?).
最佳答案 我检查了JOTM源代码,令我惊讶的是,
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();
}
...
JOTM项目开发seems to have stopped(最后两个版本可追溯到2006年和2010年),因此您应该更好地检查Narayana,Atomikos或Bitronix.