组件名称 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
@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
这个错误提示找不到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
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。