日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService

發(fā)布時(shí)間:2025/3/20 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1 異常信息

今天在寫 dubbo 文章的時(shí)候遇到一個(gè)問題,倒是折騰了幾分鐘,百思不得其解,最后終于發(fā)現(xiàn)了。異常信息如下:

com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService. Tried 3 times of the providers [localhost:2181, localhost:2182, localhost:2183] (3/3) from the registry localhost:2182 on the consumer 192.168.234.1 using the dubbo version 2.6.6. Last error is: Invoke remote method timeout. method: subscribe, provider: dubbo://localhost:2181/com.alibaba.dubbo.registry.RegistryService?application=provider&backup=localhost:2183,localhost:2181&callbacks=10000&check=false&connect.timeout=10000&dubbo=2.0.2&interface=com.alibaba.dubbo.registry.RegistryService&lazy=true&methods=lookup,subscribe,unsubscribe,unregister,register&owner=sihai&pid=2872&qos.accept.foreign.ip=false&qos.enable=true&qos.port=55555&reconnect=false&remote.timestamp=1564280535444&sticky=true&subscribe.1.callback=true&timeout=10000&timestamp=1564280535444&unsubscribe.1.callback=false, cause: Waiting server-side response timeout by scan timer. start time: 2019-07-28 10:22:38.380, end time: 2019-07-28 10:22:48.401, client elapsed: 9 ms, server elapsed: 10011 ms, timeout: 10000 ms, request: Request [id=2, version=2.0.2, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=subscribe, parameterTypes=[class com.alibaba.dubbo.common.URL, interface com.alibaba.dubbo.registry.NotifyListener], arguments=[consumer://192.168.234.1/com.alibaba.dubbo.registry.RegistryService?application=provider&backup=localhost:2183,localhost:2181&callbacks=10000&connect.timeout=10000&dubbo=2.0.2&interface=com.alibaba.dubbo.registry.RegistryService&lazy=true&methods=lookup,subscribe,unsubscribe,unregister,register&owner=sihai&pid=2872&qos.accept.foreign.ip=false&qos.enable=true&qos.port=55555&reconnect=false&sticky=true&subscribe.1.callback=true&timeout=10000&timestamp=1564280535444&unsubscribe.1.callback=false, com.alibaba.dubbo.registry.integration.RegistryDirectory@353352b6], attachments={path=com.alibaba.dubbo.registry.RegistryService, sys_callback_arg-1=892555958, interface=com.alibaba.dubbo.registry.RegistryService, version=0.0.0, timeout=10000}]], channel: 192.168.234.1:0 -> localhost/127.0.0.1:2181at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:102)at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:244)at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:75)at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52)at com.alibaba.dubbo.common.bytecode.proxy0.subscribe(proxy0.java)at com.alibaba.dubbo.registry.dubbo.DubboRegistry.doSubscribe(DubboRegistry.java:151)at com.alibaba.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:196)

其中,可以發(fā)現(xiàn)最重要異常信息就是:

com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService

如果你了解 dubbo 的架構(gòu)的話,其實(shí)你很快就能發(fā)現(xiàn),這就是注冊(cè)中心的問題。后來排查發(fā)現(xiàn),確實(shí)是注冊(cè)中心出了問題。

2 解決問題

知道是注冊(cè)中心出現(xiàn)了問題,剛剛開始以為是我設(shè)置了只訂閱的模式,但是,檢查配置發(fā)現(xiàn),并不是這種模式出現(xiàn)了問題。

后來,再仔細(xì)看了一下之前的配置發(fā)現(xiàn),是我沒有指明注冊(cè)中心是哪個(gè)?(以前用的是zookeeper)。

所以,到這里就很簡(jiǎn)單了,在下面的代碼中指明注冊(cè)中心即可。

<dubbo:registry timeout="10000" address="localhost:2182,localhost:2183,localhost:2181"></dubbo:registry>

改為

<dubbo:registry protocol="zookeeper" timeout="10000" address="localhost:2182,localhost:2183,localhost:2181"></dubbo:registry>

這樣問題就解決了。

總結(jié)

以上是生活随笔為你收集整理的Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。