首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有Hibernate(MySQL)的Atomikos存在连接错误

带有Hibernate(MySQL)的Atomikos存在连接错误
EN

Stack Overflow用户
提问于 2022-02-11 10:25:58
回答 1查看 273关注 0票数 0

我设置在属性引起的MySQL错误(错误)下面

代码语言:javascript
复制
com.atomikos.icatch.serial_jta_transactions=false
pinGlobalTxToPhysicalConnection="true"

但是,当我在设置了上级属性之后用多个请求测试它时,它会显示以下错误

代码语言:javascript
复制
XA resource 'shard0': suspend for XID '3139322E3136382E3231392E3131382E746D313634343537333034393734363030303031:3139322E3136382E3231392E3131382E746D31' raised -5: invalid arguments were given for the XA operation java.sql.SQLException: XAER_INVAL: Invalid arguments (or unsupported command)
at com.atomikos.datasource.xa.XAResourceTransaction.xaSuspend(XAResourceTransaction.java:700) [7 skipped]
at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.transactionSuspended(BranchEnlistedStateHandler.java:94)
at com.atomikos.datasource.xa.session.TransactionContext.transactionSuspended(TransactionContext.java:94)
at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:165)
at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:207)
... 140 common frames omitted

我想知道为什么我的应用程序在代码下面抛出“UnexpectedTransactionContextException”,甚至我设置了所有属性。

代码语言:javascript
复制
//BranchEnlistedStateHandler.java(Atomikos)
    TransactionContextStateHandler checkEnlistBeforeUse ( CompositeTransaction currentTx)
            throws InvalidSessionHandleStateException, UnexpectedTransactionContextException 
    {
        
        if ( currentTx == null || !currentTx.isSameTransaction ( ct ) ) {
            //OOPS! we are being used a different tx context than the one expected...
            
            //TODO check: what if subtransaction? Possible solution: ignore if serial_jta mode, error otherwise.
            
            String msg = "The connection/session object is already enlisted in a (different) transaction.";
            if ( LOGGER.isTraceEnabled() ) LOGGER.logTrace ( msg );
            throw new UnexpectedTransactionContextException();
        } 
        
        //tx context is still the same -> no change in state required
        return null;
    }java
EN

回答 1

Stack Overflow用户

发布于 2022-05-20 20:14:06

为时已晚,但这可能会对某些人有所帮助:

弹簧启动2.6.7

mysql-连接器-java 8.0.29

根据atomikos问题,错误尝试在spring引导中添加以下属性。

代码语言:javascript
复制
spring.jta.atomikos.properties.serial-jta-transactions = false
spring.datasource.xa.properties.pinGlobalTxToPhysicalConnection = true
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71078541

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档