cannot enlist more than one non-XA resource
来源:互联网 发布:mysql unix timestamp 编辑:程序博客网 时间:2024/06/02 01:59
错误场景:多个数据源三种操作方式并存。
(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>
0 0
- cannot enlist more than one non-XA resource
- Error: (E115) sc_signal<T> cannot have more than one driver:
- xa database resource 与non-xa database resoure的区别
- More than one order matters
- Read one Book more than one time
- error: L6235E: More than one section matches selector - cannot all be FIRST/LAST
- An AVPlayerItem cannot be associated with more than one instance of AVPlayer
- MDK错误More than one section matches selector - cannot all be FIRST/LAST的解决
- An AVPlayerItem cannot be associated with more than one instance of AVPlayer
- error: L6235E: More than one section matches selector - cannot all be FIRST/LAST.
- error: L6235E: More than one section matches selector - cannot all be FIRST/LAST.
- An AVPlayerItem cannot be associated with more than one instance of AVPlayer'
- Cannot create TypedQuery for query with more than one return using requested result type
- An AVPlayerItem cannot be associated with more than one instance of AVPlayer
- More than one global threading model defined
- more than one device and emulator
- Result consisted of more than one row
- more than one device and emulator
- 给定两个站点,如果没有直达的路线,如何找到换乘次数最少的路线?
- 关于MP4视频在浏览器上无法播放的问题(没有找到支持的视频格式和mime类型)
- 7 java反射总结
- 从1到1000的质数
- 个人记录-LeetCode 82. Remove Duplicates from Sorted List II
- cannot enlist more than one non-XA resource
- Linux下MyCat和MyCat_web的安装和配置
- 【Unity&NGUI】Widget的Pivot怎么用代码动态设置
- Network poj 3694(tarjan 求割边 + lca(朴素的))
- DOM4J创建xml文件
- PAT乙级1043
- ActionContext
- Java的io流使用
- python glob使用