公司使用springboot集成hibernate在调用getSession.merge(实体)方法时抛出异常:
com.atomikos.datasource.ResourceException: XA resource 'dataSource': resume for XID '3137322E32302E33362E34312E746D30303030313030303130:3137322E32302E33362E34312E746D31' raised -5: invalid arguments were given for the XA operation
最终在stackOverFlow网上找到解决方法, 记录下来,方便以后同学可以避过这个坑
原网站:https://stackoverflow.com/questions/27729496/atomikos-with-mysql-jta-not-working-properly
外国网友原文:
I think that i found the problem! it's related to Atomikos bug which is related to MySQL.
After adding the pinGlobalTxToPhysicalConnection=true parameter to the connection URL or as a parameter inside the com.atomikos.jdbc.AtomikosDataSourceBean Spring definition, It solved my problem.
我用蹩脚的英语水平大概翻译下:
(我认为我找到问题了,它应该是Atomikos链接MySQL的一个bug
在数据库连接URL上增加pinGlobalTxToPhysicalConnection=true参数后,或者在数据库配置文件中增加
spring.datasource.xa.properties.pinGlobalTxToPhysicalConnection=true参数后,问题得到解决)