spring cloud alibaba dubbo 鏈路跟蹤報(bào)錯問題解決 java.lang.NoSuchMethodError: 'void com.alibaba.dubbo.rpc.pr...

http://www.reibang.com/p/5cf443081430

spring cloud alibaba dubbo 鏈路跟蹤(sleuth谱邪、zipkin、brave) 拋出如下異常解決方案闯冷。
java.lang.NoSuchMethodError: 'void com.alibaba.dubbo.rpc.protocol.dubbo.FutureAdapter.<init>(com.alibaba.dubbo.remoting.exchange.ResponseFuture)'

  • spring boot 版本 2.2.5.RELEASE
  • spring cloud 版本 Hoxton.SR3
  • spring cloud alibaba 版本 2.2.0.RELEASE

問題復(fù)現(xiàn)

引入 sleuth战秋、brave、zipkin 的 maven 依賴如下

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
    <groupId>io.zipkin.brave</groupId>
    <artifactId>brave-instrumentation-dubbo-rpc</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>

拋出如下異常

2020-04-09 17:52:52.849 ERROR [spring-cloud-alibaba-dubbo-client,,,] 14340 --- [           main] .s.DubboMetadataServiceInvocationHandler : Failed to invoke the method getServiceRestMetadata in the service org.apache.dubbo.rpc.service.GenericService. Tried 3 times of the providers [172.16.20.162:20880] (1/1) from the registry localhost:9090 on the consumer 172.16.20.162 using the dubbo version 2.7.4.1. Last error is: 'void com.alibaba.dubbo.rpc.protocol.dubbo.FutureAdapter.<init>(com.alibaba.dubbo.remoting.exchange.ResponseFuture)'

org.apache.dubbo.rpc.RpcException: Failed to invoke the method getServiceRestMetadata in the service org.apache.dubbo.rpc.service.GenericService. Tried 3 times of the providers [172.16.20.162:20880] (1/1) from the registry localhost:9090 on the consumer 172.16.20.162 using the dubbo version 2.7.4.1. Last error is: 'void com.alibaba.dubbo.rpc.protocol.dubbo.FutureAdapter.<init>(com.alibaba.dubbo.remoting.exchange.ResponseFuture)'
    at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:113) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:248) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:78) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:55) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.common.bytecode.proxy0.$invoke(proxy0.java) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at com.alibaba.cloud.dubbo.service.DubboMetadataServiceInvocationHandler.invoke(DubboMetadataServiceInvocationHandler.java:48) ~[spring-cloud-alibaba-dubbo-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at com.sun.proxy.$Proxy150.getServiceRestMetadata(Unknown Source) ~[na:na]
    at com.alibaba.cloud.dubbo.metadata.repository.DubboServiceMetadataRepository.getServiceRestMetadataSet(DubboServiceMetadataRepository.java:597) ~[spring-cloud-alibaba-dubbo-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at com.alibaba.cloud.dubbo.metadata.repository.DubboServiceMetadataRepository.initDubboRestServiceMetadataRepository(DubboServiceMetadataRepository.java:486) ~[spring-cloud-alibaba-dubbo-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at com.alibaba.cloud.dubbo.metadata.repository.DubboServiceMetadataRepository.initSubscribedDubboMetadataService(DubboServiceMetadataRepository.java:634) ~[spring-cloud-alibaba-dubbo-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at com.alibaba.cloud.dubbo.metadata.repository.DubboServiceMetadataRepository.initializeMetadata(DubboServiceMetadataRepository.java:292) ~[spring-cloud-alibaba-dubbo-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at com.alibaba.cloud.dubbo.registry.AbstractSpringCloudRegistry.subscribeDubboServiceURL(AbstractSpringCloudRegistry.java:257) ~[spring-cloud-alibaba-dubbo-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at com.alibaba.cloud.dubbo.registry.AbstractSpringCloudRegistry.lambda$doSubscribeDubboServiceURLs$0(AbstractSpringCloudRegistry.java:206) ~[spring-cloud-alibaba-dubbo-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
    at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085) ~[na:na]
    at com.alibaba.cloud.dubbo.registry.AbstractSpringCloudRegistry.doSubscribeDubboServiceURLs(AbstractSpringCloudRegistry.java:206) ~[spring-cloud-alibaba-dubbo-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at com.alibaba.cloud.dubbo.registry.AbstractSpringCloudRegistry.subscribeDubboServiceURLs(AbstractSpringCloudRegistry.java:172) ~[spring-cloud-alibaba-dubbo-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at com.alibaba.cloud.dubbo.registry.AbstractSpringCloudRegistry.doSubscribe(AbstractSpringCloudRegistry.java:166) ~[spring-cloud-alibaba-dubbo-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at org.apache.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:295) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.registry.integration.RegistryDirectory.subscribe(RegistryDirectory.java:172) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:412) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:393) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:71) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:69) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:128) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:396) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:329) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:250) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.getOrCreateProxy(ReferenceAnnotationBeanPostProcessor.java:246) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.doGetInjectedBean(ReferenceAnnotationBeanPostProcessor.java:143) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.getInjectedObject(AnnotationInjectedBeanPostProcessor.java:359) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor$AnnotatedFieldElement.inject(AnnotationInjectedBeanPostProcessor.java:539) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.postProcessPropertyValues(AnnotationInjectedBeanPostProcessor.java:146) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1427) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[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.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at com.test.dubbo.client.DubboSpringCloudClientBootstrap.main(DubboSpringCloudClientBootstrap.java:150) ~[classes/:na]
Caused by: java.lang.NoSuchMethodError: 'void com.alibaba.dubbo.rpc.protocol.dubbo.FutureAdapter.<init>(com.alibaba.dubbo.remoting.exchange.ResponseFuture)'
    at brave.dubbo.rpc.TracingFilter.ensureSpanFinishes(TracingFilter.java:167) ~[brave-instrumentation-dubbo-rpc-5.10.1.jar:na]
    at brave.dubbo.rpc.TracingFilter.invoke(TracingFilter.java:126) ~[brave-instrumentation-dubbo-rpc-5.10.1.jar:na]
    at com.alibaba.dubbo.rpc.Filter.invoke(Filter.java:29) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.filter.GenericImplFilter.invoke(GenericImplFilter.java:119) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:92) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:54) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:60) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$CallbackRegistrationInvoker.invoke(ProtocolFilterWrapper.java:157) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:82) ~[dubbo-2.7.4.1.jar:2.7.4.1]
    ... 51 common frames omitted

問題排查分析

NoSuchMethodError 是一個Error砰识,依賴的三方庫運(yùn)行時找不到方法,說明有jar包版本沖突佣渴。經(jīng)過排查辫狼,項(xiàng)目中引入的 dubbo 版本是 2.7.4.1 ,但是 brave-instrumentation-dubbo-rpc 依賴的 dubbo 版本是 2.6.x 版本的辛润。
但是項(xiàng)目中引入的 brave-instrumentation-dubbo-rpc 已經(jīng)是最新的膨处。通過下載 brave 源碼發(fā)現(xiàn)還有個 apache 的 dubbo brave-instrumentation-dubbo沒有 -rpc 的砂竖,如下圖真椿。
最后將 maven 依賴修改為brave-instrumentation-dubbo解決問題。
dubbo 2.6是alibaba的晦溪。從2.7開始捐獻(xiàn)給apache瀑粥。

image.png

解決后的maven依賴如下

  • brave-instrumentation-dubbo
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
    <groupId>io.zipkin.brave</groupId>
    <artifactId>brave-instrumentation-dubbo</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市三圆,隨后出現(xiàn)的幾起案子狞换,更是在濱河造成了極大的恐慌,老刑警劉巖舟肉,帶你破解...
    沈念sama閱讀 206,602評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件修噪,死亡現(xiàn)場離奇詭異,居然都是意外死亡路媚,警方通過查閱死者的電腦和手機(jī)黄琼,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,442評論 2 382
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來整慎,“玉大人脏款,你說我怎么就攤上這事】阍埃” “怎么了撤师?”我有些...
    開封第一講書人閱讀 152,878評論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長拧揽。 經(jīng)常有香客問我剃盾,道長腺占,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 55,306評論 1 279
  • 正文 為了忘掉前任痒谴,我火速辦了婚禮衰伯,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘积蔚。我一直安慰自己意鲸,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,330評論 5 373
  • 文/花漫 我一把揭開白布尽爆。 她就那樣靜靜地躺著临扮,像睡著了一般。 火紅的嫁衣襯著肌膚如雪教翩。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,071評論 1 285
  • 那天贪壳,我揣著相機(jī)與錄音饱亿,去河邊找鬼。 笑死闰靴,一個胖子當(dāng)著我的面吹牛彪笼,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播蚂且,決...
    沈念sama閱讀 38,382評論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼配猫,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了杏死?” 一聲冷哼從身側(cè)響起泵肄,我...
    開封第一講書人閱讀 37,006評論 0 259
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎淑翼,沒想到半個月后腐巢,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,512評論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡玄括,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,965評論 2 325
  • 正文 我和宋清朗相戀三年冯丙,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片遭京。...
    茶點(diǎn)故事閱讀 38,094評論 1 333
  • 序言:一個原本活蹦亂跳的男人離奇死亡胃惜,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出哪雕,到底是詐尸還是另有隱情船殉,我是刑警寧澤,帶...
    沈念sama閱讀 33,732評論 4 323
  • 正文 年R本政府宣布热监,位于F島的核電站捺弦,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜列吼,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,283評論 3 307
  • 文/蒙蒙 一幽崩、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧寞钥,春花似錦慌申、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,286評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至您炉,卻和暖如春柒爵,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背赚爵。 一陣腳步聲響...
    開封第一講書人閱讀 31,512評論 1 262
  • 我被黑心中介騙來泰國打工棉胀, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人冀膝。 一個月前我還...
    沈念sama閱讀 45,536評論 2 354
  • 正文 我出身青樓唁奢,卻偏偏與公主長得像,于是被迫代替她去往敵國和親窝剖。 傳聞我的和親對象是個殘疾皇子麻掸,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,828評論 2 345

推薦閱讀更多精彩內(nèi)容