开发者社区 > 云原生 > 正文

spring-cloud霍克斯顿.SR3+spring-cloud-alibaba2.2.0.REL

组件名称 Nacos Discovery, Sentinel,openfeign

错误描述 integration errors

To Reproduce Steps to reproduce the behavior:

1.com.alibaba.cloud spring-cloud-alibaba-dependencies 2.2.0.RELEASE pom import

org.springframework.cloud spring-cloud-dependencies Hoxton.SR3 pom import

com.alibaba.cloud spring-cloud-starter-alibaba-sentinel

org.springframework.cloud spring-cloud-starter-openfeign

org.springframework.boot spring-boot-starter-actuator

org.springframework.boot spring-boot-starter-web

com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery

org.projectlombok lombok true

  1. create a interface

@FeignClient(value = "nacos-payment-provider", fallback = PaymentFeignServiceImpl.class) public interface PaymentFeignService { @GetMapping("paymentSQL/{id}") CommonResult paymentSQL(@PathVariable("id") Integer id); } 3. create the interface impl public class PaymentFeignServiceImpl implements PaymentFeignService { @OverRide public CommonResult paymentSQL(Integer id) { return new CommonResult(444, "服务降级返回", new Payment(id, "error")); } } 4. run 5. error

6.if update spring cloud Hoxton version from Hoxton.SR3 to Hoxton.SR1 ,run good

PaymentFeignService': FactoryBean threw exception on object creation; nested exception is java.lang.AbstractMethodError: com.alibaba.cloud.sentinel.feign.SentinelContractHolder.parseAndValidateMetadata(Ljava/lang/Class;)Ljava/util/List; at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1818) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1266) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1510) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1467) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1250) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] ... 19 common frames omitted Caused by: java.lang.AbstractMethodError: com.alibaba.cloud.sentinel.feign.SentinelContractHolder.parseAndValidateMetadata(Ljava/lang/Class;)Ljava/util/List; at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:151) ~[feign-core-10.7.4.jar:na] at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:49) ~[feign-core-10.7.4.jar:na] at feign.Feign$Builder.target(Feign.java:252) ~[feign-core-10.7.4.jar:na] at org.springframework.cloud.openfeign.HystrixTargeter.target(HystrixTargeter.java:38) ~[spring-cloud-openfeign-core-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.cloud.openfeign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:253) ~[spring-cloud-openfeign-core-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.cloud.openfeign.FeignClientFactoryBean.getTarget(FeignClientFactoryBean.java:282) ~[spring-cloud-openfeign-core-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.cloud.openfeign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:262) ~[spring-cloud-openfeign-core-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE] ... 30 common frames omitted

the full pom.xml

4.0.0 org.springframework.boot spring-boot-starter-parent 2.2.5.RELEASE com.atguigu.springcloud cloudaliabba-consumer-nacos-order84 0.0.1-SNAPSHOT cloudaliabba-consumer-nacos-order84 Demo project for Spring Boot UTF-8 1.8 1.8 Hoxton.SR3 com.alibaba.cloud spring-cloud-starter-alibaba-sentinel org.springframework.cloud spring-cloud-starter-openfeign org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-web com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery org.projectlombok lombok true com.atguigu.springcloud cloud-api-commons 1.0-SNAPSHOT org.springframework.boot spring-boot-starter-test test org.junit.vintage junit-vintage-engine com.alibaba.cloud spring-cloud-alibaba-dependencies 2.2.0.RELEASE pom import org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import org.springframework.boot spring-boot-maven-plugin

原提问者GitHub用户ruoshuixuelabi

展开
收起
白夜行fighting 2023-06-11 10:11:58 184 0
1 条回答
写回答
取消 提交回答
  • 这个错误提示找不到parseAndValidateMetadata方法: com.alibaba.cloud.sentinel.feign.SentinelContractHolder.parseAndValidateMetadata(Ljava/lang/Class;)Ljava/util/List; 是因为com.alibaba.cloud.sentinel-2.2.0.RELEASE包中的方法名变成了parseAndValidatateMetadata(原来的是parseAndValidateMetadata) 你可以自己新建相同的类包,然后把SentinelContractHolder类的代码拷过去,然后把方法名改回去就行了

    原回答者GitHub用户iamyxq

    2023-06-11 11:14:22
    赞同 展开评论 打赏
问答标签:
问答地址:

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载
阿里特邀专家徐雷Java Spring Boot开发实战系列课程(第18讲):制作Java Docker镜像与推送到DockerHub和阿里云Docker仓库 立即下载