Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService
生活随笔
收集整理的這篇文章主要介紹了
Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 異常信息
今天在寫 dubbo 文章的時候遇到一個問題,倒是折騰了幾分鐘,百思不得其解,最后終于發現了。異常信息如下:
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×tamp=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×tamp=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)其中,可以發現最重要異常信息就是:
com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService如果你了解 dubbo 的架構的話,其實你很快就能發現,這就是注冊中心的問題。后來排查發現,確實是注冊中心出了問題。
2 解決問題
知道是注冊中心出現了問題,剛剛開始以為是我設置了只訂閱的模式,但是,檢查配置發現,并不是這種模式出現了問題。
后來,再仔細看了一下之前的配置發現,是我沒有指明注冊中心是哪個?(以前用的是zookeeper)。
所以,到這里就很簡單了,在下面的代碼中指明注冊中心即可。
<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>這樣問題就解決了。
總結
以上是生活随笔為你收集整理的Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一定是你想要的微服务资源springbo
- 下一篇: Dubbo 一篇文章就够了:Dubbo遇