请问openfeign 使用分布式注解,失败了不回滚是怎么回事呀?

请问openfeign 使用分布式注解 @GlobalTransactional,失败了不回滚是怎么回事呀?Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.seata.spring.annotation.GlobalTransactionScanner]: Factory method 'globalTransactionScanner' threw exception; nested exception is io.seata.common.exception.ShouldNeverHappenException: Can't find any object of class org.springframework.context.ApplicationContext at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] ... 19 common frames omittedCaused by: io.seata.common.exception.ShouldNeverHappenException: Can't find any object of class org.springframework.context.ApplicationContext

展开
收起
fuxixi 2022-10-08 14:57:29 1392 分享 版权
1 条回答
写回答
取消 提交回答
  • 事务没有回滚 1、先检查异常是否被catch或者有无熔断降级 异常被catch后或熔断降级后,全局事务便不感知抛出的异常。建议catch异常后返回异常码给事务发起方(TM),然后事务发起方 (TM) 。通过API的方式回滚全局事务。 2、否则请自行debug以下方法: ExecuteTemplate#execute(List, StatementProxy, StatementCallback<T,S>, java.lang.Object...) 如果没进入这个方法,说明数据源被没有代理。 如果没进入 if (CollectionUtils.isEmpty(sqlRecognizers)) { sqlRecognizers = SQLVisitorFactory.get(statementProxy.getTargetSQL(),dbType); } 没进去说明xid没有传递。此答案整理自钉钉群“3群-Seata 开源讨论群”

    2022-10-08 15:56:36
    赞同 展开评论

为企业提供高效、稳定、易扩展的中间件产品。

收录在圈子:
+ 订阅
阿里云中间件主要有包含这么几个: 分布式关系型数据库DRDS_水平拆分 做数据库扩展性的 、消息队列MQ 是做消息的中间件、企业级分布式应用服务EDAS 做分布式服务的、还有一些其他的中间件,比如配置服务、缓存等等。
还有其他疑问?
咨询AI助理