cannot enlist more than one non-XA resource
错误场景:多个数据源三种操作方式并存。
(1) 关闭事务,使用jdbc执行建表语句
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
(2)(3) 又使用了hibernate在不同sessionFacory之间切换执行sql。
错误代码:cannot enlist more than one non-XA resource, tried enlisting an XAResourceHolderState with uniqueName=dataSourceSCDP XAResource=a JDBC LrcXAResource in state NO_TX with XID null, already enlisted: an XAResourceHolderState with uniqueName=dataSource.1 XAResource=a JDBC LrcXAResource in state STARTED (started) with XID a Bitronix XID [3139322E3136382E35362E31000000000A6647B900000039 : 3139322E3136382E35362E31000000000A6647FE0000003A]
解决方案:
数据源的Driver使用 com.mysql.jdbc.jdbc2.optional.MysqlXADataSource.
同时附上datasouce配置:
<bean id="dataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close"> <property name="className" value="${jdbc.driver}"/> <property name="uniqueName" value="dataSource"/> <!--the minimal amount of connections that can be in the pool.--> <property name="minPoolSize" value="${jdbc.minPoolSize}"/> <!--the maximum amount of connections that can be in the pool.--> <property name="maxPoolSize" value="${jdbc.maxPoolSize}"/> <!--the amount of seconds and idle connection can stay in the pool before getting closed.--> <property name="maxIdleTime" value="300"/> <!--the amount of connections to be created at once when the pool needs to grow.--> <property name="acquireIncrement" value="2"/> <!--the amount of time between failed connection acquirements.--> <property name="acquisitionInterval" value="1"/> <!--the amount of time in seconds a call to get a connection from the pool will wait when the pool is empty.--> <property name="acquisitionTimeout" value="2"/> <!--false only if the database can run many transactions on the same connection.--> <property name="deferConnectionRelease" value="true"/> <!--true if the transaction manager should allow mixing XA and non-XA transactions.--> <property name="allowLocalTransactions" value="true"/> <property name="applyTransactionTimeout" value="true"/> <!--Set whether connections in the ACCESSIBLE state can be shared within the context of a transaction.--> <property name="shareTransactionConnections" value="true"/> <property name="driverProperties"> <props> <prop key="url">${jdbc.url}</prop> <prop key="user">${jdbc.username}</prop> <prop key="password">${jdbc.password}</prop> </props> </property> <property name="testQuery" value="SELECT 1"/> </bean>
cannot enlist more than one non-XA resource相关推荐
- com.atomikos.datasource.ResourceException: XA resource ‘masterDB‘: resume for XID异常
com.atomikos.datasource.ResourceException: XA resource 'masterDB': resume for XID异常 参考文章: (1)com.ato ...
- MySQL分布式事务(XA事务)
MySQL分布式事务(XA事务) 官网:https://dev.mysql.com/doc/refman/5.7/en/xa.html 1.什么是分布式事务 分布式事务就是指事务的参与者.支持事务的服 ...
- MySQL中基于XA实现的分布式事务
文章目录 一.前言 二.XA基础 2.1 XA基础知识 2.1.1 DTP是什么? 2.1.2 DTP的结构:AP TM RM(重点001) 2.1.3 DTP的重要概念 2.2 XA事务:基于两阶段 ...
- XA 分布式事务原理
概念 XA是由X/Open组织提出的分布式事务的规范. XA规范主要定义了(全局)事务管理器(TM)和(局 部)资源管理器(RM)之间的接口.主流的关系型 数据库产品都是实现了XA接口的. XA ...
- 深度剖析Apache Shardingsphere对分布式事务的支持
Apache ShardingSphere 是一套开源的分布式数据库中间件解决方案组成的生态圈,它由 JDBC.Proxy 和 Sidecar(规划中)这 3 款相互独立,却又能够混合部署配合使用的产 ...
- spring mysql 分布式_spring atomikos mysql 分布式 报错?
spring atomikos mysql 分布式 偶尔出现这样的问题? com.atomikos.datasource.ResourceException: XA resource 'my': re ...
- atomikos mysql_mysql – Atomikos:当事务包含多个持久性时的异常
我正在试验Atomikos提供的独立JPA和JTA / XA事务管理. 我的简单单元测试持久存储3条记录,包含在JTA UserTransaction中. 使用H2作为后备数据库时,测试工作正常. 使 ...
- atomikos mysql_mysql – Atomikos:当事务包含多个持久性时...
我正在试验Atomikos提供的独立JPA和JTA / XA事务管理. 我的简单单元测试持久存储3条记录,包含在JTA UserTransaction中. 使用H2作为后备数据库时,测试工作正常. 使 ...
- springboot的自动配置原理
SpringBoot中的默认配置 通过刚才的学习,我们知道@EnableAutoConfiguration会开启SpringBoot的自动配置,并且根据你引入的依赖来生效对应的默认配置.那么问题来了: ...
- spring boot application.properties 属性详解
2019年3月21日17:09:59 英文原版: https://docs.spring.io/spring-boot/docs/current/reference/html/common-appli ...
最新文章
- 使用Linux建立拨号服务器
- 如何基于OSS和MPS,快速搭建音视频文件上传服务?
- QQ采用什么传输协议?
- UA SIE545 优化理论基础4 对偶理论简介4 求解对偶问题的割平面算法
- 使用netty搭建一个简单的聊天室
- 相当于零负担的延时程序(转)
- 快速安装puppeteer (跳过安装Chromium)
- Python设置常量不可修改的办法
- Spring之WebSocket网页聊天以及服务器推送
- 2021年吉林高考成绩怎么查询,2021年吉林高考成绩排名查询系统,吉林高考位次排名查询...
- win10 linux声音,win10电脑突然没有声音的10种修复方法
- 【备注】【C14】《HeadFirstJava(中文版)(第2版)》 PDF 下载
- bp神经网络预测模型实例,bp神经网络模型的建立
- iOS 唤起第三方App
- c270 linux驱动下载,佳能 HD Webcam C270 驱动程序下载-更新佳能软件(网络摄像头)
- linux挂载NTFS格式硬盘
- Ubuntu中配置WRF
- 网站流量的算法是怎么算的?网站每月10G流量够用吗
- 苹果弃妇效应再现:Audience一夜跌去63%(转)
- 光伏发电并网matlab/simulink仿真,带PLL锁相环,逆变器控制,最大功率控制MPPT,BOOST升压电路
热门文章
- Debian搭建SVN服务器
- linux编译hashcat,Hashcat用户手册——hashcat在linux系统下的安装
- CSAPP Bomb Lab
- win10子系统ubuntu文件夹位置_Win10 Linux子系统任何直接访问文件
- 谷歌浏览器(chrome)无法正常打开网页的解决办法
- Stm32cubeIDE1.8 增加代码补齐
- 什么是下一代防火墙NGFW(Next Generation Firewall)?
- 并发编程(三)---共享模型之管程
- 录音转成文字的方法分享
- 计算合式公式(wff) 【让你的离散作业变的更轻松】