开发者社区 > 云原生 > 中间件 > 正文

请问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 1203 0
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
    赞同 展开评论 打赏
问答地址:

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

热门讨论

热门文章

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载