dubbo消费者调用报错java.lang.NoSuchMethodError: org.jboss.resteasy.spi.ResteasyProviderFactory

赫连睿
2023-12-01

 

10:48:23.233 [localhost-startStop-1] INFO  com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry -  [DUBBO] Notify urls for subscribe url consumer://172.17.0.1/cn.rkang.service.base.service.AreaService?application=rkang-mall&category=providers,configurators,routers&check=true&dubbo=2.8.3&interface=cn.rkang.service.base.service.AreaService&logger=slf4j&methods=getAllCityList,getCityCodeByBaiDuName,queryAreaInfoPage,getAreaList,createNewArea,areaCodeValidate,modifyArea,getDistrictList,getHotAreaInfo,closeArea,getAreaListByType,getOpeningAreaList,openArea,getAllAreaInfo,getAllCityFromRedis,getArea&pid=8518&retries=0&revision=1.0-SNAPSHOT&side=consumer&timeout=5000&timestamp=1555987703190, urls: [dubbo://172.19.145.65:20880/cn.rkang.service.base.service.AreaService?anyhost=true&application=rkang-all-services&default.dispatcher=execution&default.service.filter=-exception&dubbo=2.8.3&generic=false&interface=cn.rkang.service.base.service.AreaService&logger=slf4j&methods=getAllCityList,getCityCodeByBaiDuName,queryAreaInfoPage,getAreaList,createNewArea,areaCodeValidate,modifyArea,getDistrictList,getHotAreaInfo,getAreaListByType,closeArea,getOpeningAreaList,openArea,getAllAreaInfo,getAllCityFromRedis,getArea&module=all-in-one&pid=8375&revision=1.0-SNAPSHOT&serialization=kryo&side=provider&threadpool=limited&timestamp=1555987654683, rest://172.19.145.65:8081/cn.rkang.service.base.service.AreaService?anyhost=true&application=rkang-all-services&default.dispatcher=execution&default.service.filter=-exception&dubbo=2.8.3&generic=false&interface=cn.rkang.service.base.service.AreaService&logger=slf4j&methods=getAllCityList,getCityCodeByBaiDuName,queryAreaInfoPage,getAreaList,createNewArea,areaCodeValidate,modifyArea,getDistrictList,getHotAreaInfo,getAreaListByType,closeArea,getOpeningAreaList,openArea,getAllAreaInfo,getAllCityFromRedis,getArea&module=all-in-one&pid=8375&revision=1.0-SNAPSHOT&server=tomcat&side=provider&timestamp=1555987654643, empty://172.17.0.1/cn.rkang.service.base.service.AreaService?application=rkang-mall&category=configurators&check=true&dubbo=2.8.3&interface=cn.rkang.service.base.service.AreaService&logger=slf4j&methods=getAllCityList,getCityCodeByBaiDuName,queryAreaInfoPage,getAreaList,createNewArea,areaCodeValidate,modifyArea,getDistrictList,getHotAreaInfo,closeArea,getAreaListByType,getOpeningAreaList,openArea,getAllAreaInfo,getAllCityFromRedis,getArea&pid=8518&retries=0&revision=1.0-SNAPSHOT&side=consumer&timeout=5000&timestamp=1555987703190, empty://172.17.0.1/cn.rkang.service.base.service.AreaService?application=rkang-mall&category=routers&check=true&dubbo=2.8.3&interface=cn.rkang.service.base.service.AreaService&logger=slf4j&methods=getAllCityList,getCityCodeByBaiDuName,queryAreaInfoPage,getAreaList,createNewArea,areaCodeValidate,modifyArea,getDistrictList,getHotAreaInfo,closeArea,getAreaListByType,getOpeningAreaList,openArea,getAllAreaInfo,getAllCityFromRedis,getArea&pid=8518&retries=0&revision=1.0-SNAPSHOT&side=consumer&timeout=5000&timestamp=1555987703190], dubbo version: 2.8.3, current host: 172.17.0.1
10:48:23.408 [localhost-startStop-1] ERROR com.alibaba.dubbo.registry.integration.RegistryDirectory -  [DUBBO] Failed to refer invoker for interface:interface cn.rkang.service.base.service.AreaService,url:(rest://172.19.145.65:8081/cn.rkang.service.base.service.AreaService?anyhost=true&application=rkang-mall&check=false&default.dispatcher=execution&default.service.filter=-exception&dubbo=2.8.3&generic=false&interface=cn.rkang.service.base.service.AreaService&logger=slf4j&methods=getAllCityList,getCityCodeByBaiDuName,queryAreaInfoPage,getAreaList,createNewArea,areaCodeValidate,modifyArea,getDistrictList,getHotAreaInfo,getAreaListByType,closeArea,getOpeningAreaList,openArea,getAllAreaInfo,getAllCityFromRedis,getArea&module=all-in-one&pid=8518&retries=0&revision=1.0-SNAPSHOT&server=tomcat&side=consumer&timeout=5000&timestamp=1555987703190)org.jboss.resteasy.spi.ResteasyProviderFactory.<init>(Lorg/jboss/resteasy/spi/ResteasyProviderFactory;Z)V, dubbo version: 2.8.3, current host: 172.17.0.1
java.lang.NoSuchMethodError: org.jboss.resteasy.spi.ResteasyProviderFactory.<init>(Lorg/jboss/resteasy/spi/ResteasyProviderFactory;Z)V
    at org.jboss.resteasy.client.jaxrs.internal.LocalResteasyProviderFactory.<init>(LocalResteasyProviderFactory.java:20) ~[resteasy-client-3.6.3.Final.jar:3.6.3.Final]
    at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.getProviderFactory(ResteasyClientBuilder.java:382) ~[resteasy-client-3.6.3.Final.jar:3.6.3.Final]
    at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.buildOld(ResteasyClientBuilder.java:391) ~[resteasy-client-3.6.3.Final.jar:3.6.3.Final]
    at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.build(ResteasyClientBuilder.java:414) ~[resteasy-client-3.6.3.Final.jar:3.6.3.Final]
    at com.alibaba.dubbo.rpc.protocol.rest.RestProtocol.doRefer(RestProtocol.java:146) ~[dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol.refer(AbstractProxyProtocol.java:88) ~[dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:62) ~[dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:65) ~[dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.rpc.Protocol$Adpative.refer(Protocol$Adpative.java) ~[dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.integration.RegistryDirectory.toInvokers(RegistryDirectory.java:395) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.integration.RegistryDirectory.refreshInvoker(RegistryDirectory.java:224) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.integration.RegistryDirectory.notify(RegistryDirectory.java:195) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.support.AbstractRegistry.notify(AbstractRegistry.java:449) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.support.FailbackRegistry.doNotify(FailbackRegistry.java:273) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.support.FailbackRegistry.notify(FailbackRegistry.java:259) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(ZookeeperRegistry.java:170) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:189) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.integration.RegistryDirectory.subscribe(RegistryDirectory.java:133) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:271) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:254) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:60) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:63) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.rpc.Protocol$Adpative.refer(Protocol$Adpative.java) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:392) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138) [dubbo-2.8.3.jar:2.8.3]
    at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65) [dubbo-2.8.3.jar:2.8.3]
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:166) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1467) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:921) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:864) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:779) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:503) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:295) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1148) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1123) [spring-context-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:323) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:235) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:194) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) [catalina.jar:8.0.32]
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) [catalina.jar:8.0.32]
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) [catalina.jar:8.0.32]
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4659) [catalina.jar:8.0.32]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5281) [catalina.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) [catalina.jar:8.0.32]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) [catalina.jar:8.0.32]
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) [catalina.jar:8.0.32]
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) [catalina.jar:8.0.32]
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939) [catalina.jar:8.0.32]
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812) [catalina.jar:8.0.32]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_181]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_181]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
10:48:23.414 [localhost-startStop-1] INFO  com.alibaba.dubbo.config.AbstractConfig -  [DUBBO] Refer dubbo service cn.rkang.service.base.service.AreaService from url zookeeper://172.19.145.65:2181/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=rkang-mall&check=true&default.dispatcher=execution&default.service.filter=-exception&dubbo=2.8.3&generic=false&interface=cn.rkang.service.base.service.AreaService&logger=slf4j&methods=getAllCityList,getCityCodeByBaiDuName,queryAreaInfoPage,getAreaList,createNewArea,areaCodeValidate,modifyArea,getDistrictList,getHotAreaInfo,closeArea,getAreaListByType,getOpeningAreaList,openArea,getAllAreaInfo,getAllCityFromRedis,getArea&module=all-in-one&pid=8518&retries=0&revision=1.0-SNAPSHOT&serialization=kryo&server=tomcat&side=consumer&timeout=5000&timestamp=1555987703190, dubbo version: 2.8.3, current host: 172.17.0.1


dubbo消费者报错NoSuchMethodError,错误日志说ResteasyProviderFactory中有个方法不存在,这个类是resteasy-jaxrs中的,应该是jar包版本不统一,使用mvn dependency:tree打印服务提供者依赖树到txt查看

[INFO] |  +- org.jboss.resteasy:jaxrs-api:jar:3.0.7.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.7.Final:compile

打印服务消费者依赖树,果然

[INFO] \- org.jboss.resteasy:resteasy-client:jar:3.6.3.Final:compile

解决方法:统一版本为3.0.7.Final后,问题解决

 类似资料: