JTA事务已经回滚(可能是由于超时)

时间:2017-06-19 08:05:28

标签: spring jta

当我以调试模式启动服务器并调试我的代码时,此错误将会到来。如果我跳过断点意味着它会起作用。我该怎么办?

org.springframework.transaction.UnexpectedRollbackException: JTA transaction already rolled back (probably due to a timeout)
at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1021)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:504)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:292)

1 个答案:

答案 0 :(得分:0)

它的正常行为,如果事务方法有超时(任何,5秒),并且您调试该上下文的时间超过5秒,则事务应该超时并出现异常。

您可以尝试临时(用于调试目的)排除添加@EnableTransactionManagement

的配置

试图在我的春季启动应用中排除,调试效果很好

@SpringBootApplication(exclude = DataSourceTransactionManagerAutoConfiguration.class)