[alibaba/spring-cloud-alibaba]Sentinel 集成feign 启动报错

2024-07-17 812 views
8

1:添加如下配置项目启动报错 feign.sentinel.enabled = true

2:Sentinel Version : 1.8.1 spring-boot version: 2.3.2 spring cloud version: Hoxton.SR9 spring cloud alibaba version: 2.2.6.RELEASE

3: 错误信息如下: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cloud.order.client.ProductClient': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: No bean found of type class feign.Feign$Builder for product-server at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:176) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1827) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1265) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1532) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1489) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1270) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ... 46 common frames omitted Caused by: java.lang.IllegalStateException: No bean found of type class feign.Feign$Builder for product-server at org.springframework.cloud.openfeign.FeignClientFactoryBean.get(FeignClientFactoryBean.java:283) at org.springframework.cloud.openfeign.FeignClientFactoryBean.feign(FeignClientFactoryBean.java:105) at org.springframework.cloud.openfeign.FeignClientFactoryBean.getTarget(FeignClientFactoryBean.java:337) at org.springframework.cloud.openfeign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:327) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:169) ... 57 common frames omitted

无法创建FeignClient 的bean对象

PS:个人感觉是版本问题,但是试了好几个版本都启动不了。

回答

5

请提供更多的信息,如果可以的话,提供一个简易的复现demo可以更好的定位问题

0

抱歉啊,我上面的配置写错了,是配置了 feign.sentinel.enabled = true。

demo的话我目前无法提供的。您这边还需要什么更多的信息的

8

我昨天调试了一下,发现确实是seata和sentinel冲突的问题,我移除了seata依赖没有问题,但是情况是目前我项目中是需要用到seata解决分布式事务问题的。所以我想问一下,在不移除seata的情况下,有没有一种好的解决方案呢?

9

解决了吗,我也是这个问题