UnexpectedRollbackException - 完整的场景分析 [英] UnexpectedRollbackException - a full scenario analysis
问题描述
从Spring的文档中:
尝试提交事务导致意外回滚时抛出
我想一次性了解
-
究竟是什么原因?
- 回滚发生在哪里?在App Server代码或数据库中?
- 是否由于特定的基础异常(例如java.sql。*中的某些内容)导致?
- 是否与Hibernate相关?是否与Spring Transaction Manager(在我的情况下是非JTA)有关?
-
如何避免? / strong>有什么最佳做法可以避免吗?
- 如何调试?似乎很难复制,任何经过验证的方法解决方案
在日志中滚动一点点(或增加它的缓冲区-size),你会看到究竟是什么造成的例外。
如果没有发生,请查看 getMostSpecificCause()
和 getRootCause()
方法 UnexpectedRollbackException
- 它们可能很有用。
All I know about this exception is from Spring's documentation and some forum posts with frostrated developers pasting huge stack traces, and no replies.
From Spring's documentation:
Thrown when an attempt to commit a transaction resulted in an unexpected rollback
I want to understand once and for all
Exactly what causes it?
- Where did the rollback occur? in the App Server code or in the Database?
- Was it caused due to a specific underlying exception (e.g. something from java.sql.*)?
- Is it related to Hibernate? Is it related to Spring Transaction Manager (non JTA in my case)?
How to avoid it? is there any best practice to avoid it?
- How to debug it? it seems to be hard to reproduce, any proven ways to troubleshoot it?
Scroll a little more back in the log (or increase it's buffer-size) and you will see what exactly caused the exception.
If it happens not to be there, check the getMostSpecificCause()
and getRootCause()
methods of UnexpectedRollbackException
- they might be useful.
这篇关于UnexpectedRollbackException - 完整的场景分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!