解决raised -5: invalid arguments were given for the XA operation异常

公司使用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
参数后,问题得到解决)
  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值