我设置在属性引起的MySQL错误(错误)下面
com.atomikos.icatch.serial_jta_transactions=false
pinGlobalTxToPhysicalConnection="true"但是,当我在设置了上级属性之后用多个请求测试它时,它会显示以下错误
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”,甚至我设置了所有属性。
//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发布于 2022-05-20 20:14:06
为时已晚,但这可能会对某些人有所帮助:
弹簧启动2.6.7
mysql-连接器-java 8.0.29
根据atomikos问题,错误尝试在spring引导中添加以下属性。
spring.jta.atomikos.properties.serial-jta-transactions = false
spring.datasource.xa.properties.pinGlobalTxToPhysicalConnection = truehttps://stackoverflow.com/questions/71078541
复制相似问题