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&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)

其中,可以发现最重要异常信息就是:

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的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/495762

相关文章

解决SpringBoot启动报错:Failed to load property source from location 'classpath:/application.yml'

《解决SpringBoot启动报错:Failedtoloadpropertysourcefromlocationclasspath:/application.yml问题》这篇文章主要介绍... 目录在启动SpringBoot项目时报如下错误原因可能是1.yml中语法错误2.yml文件格式是GBK总结在启动S

springboot+dubbo实现时间轮算法

《springboot+dubbo实现时间轮算法》时间轮是一种高效利用线程资源进行批量化调度的算法,本文主要介绍了springboot+dubbo实现时间轮算法,文中通过示例代码介绍的非常详细,对大家... 目录前言一、参数说明二、具体实现1、HashedwheelTimer2、createWheel3、n

MyBatis-Plus中Service接口的lambdaUpdate用法及实例分析

《MyBatis-Plus中Service接口的lambdaUpdate用法及实例分析》本文将详细讲解MyBatis-Plus中的lambdaUpdate用法,并提供丰富的案例来帮助读者更好地理解和应... 目录深入探索MyBATis-Plus中Service接口的lambdaUpdate用法及示例案例背景

C# 委托中 Invoke/BeginInvoke/EndInvoke和DynamicInvoke 方法的区别和联系

《C#委托中Invoke/BeginInvoke/EndInvoke和DynamicInvoke方法的区别和联系》在C#中,委托(Delegate)提供了多种调用方式,包括Invoke、Begi... 目录前言一、 Invoke方法1. 定义2. 特点3. 示例代码二、 BeginInvoke 和 EndI

Android里面的Service种类以及启动方式

《Android里面的Service种类以及启动方式》Android中的Service分为前台服务和后台服务,前台服务需要亮身份牌并显示通知,后台服务则有启动方式选择,包括startService和b... 目录一句话总结:一、Service 的两种类型:1. 前台服务(必须亮身份牌)2. 后台服务(偷偷干

Spring AI Alibaba接入大模型时的依赖问题小结

《SpringAIAlibaba接入大模型时的依赖问题小结》文章介绍了如何在pom.xml文件中配置SpringAIAlibaba依赖,并提供了一个示例pom.xml文件,同时,建议将Maven仓... 目录(一)pom.XML文件:(二)application.yml配置文件(一)pom.xml文件:首

使用TomCat,service输出台出现乱码的解决

《使用TomCat,service输出台出现乱码的解决》本文介绍了解决Tomcat服务输出台中文乱码问题的两种方法,第一种方法是修改`logging.properties`文件中的`prefix`和`... 目录使用TomCat,service输出台出现乱码问题1解决方案问题2解决方案总结使用TomCat,

解决systemctl reload nginx重启Nginx服务报错:Job for nginx.service invalid问题

《解决systemctlreloadnginx重启Nginx服务报错:Jobfornginx.serviceinvalid问题》文章描述了通过`systemctlstatusnginx.se... 目录systemctl reload nginx重启Nginx服务报错:Job for nginx.javas

Python Invoke自动化任务库的使用

《PythonInvoke自动化任务库的使用》Invoke是一个强大的Python库,用于编写自动化脚本,本文就来介绍一下PythonInvoke自动化任务库的使用,具有一定的参考价值,感兴趣的可以... 目录什么是 Invoke?如何安装 Invoke?Invoke 基础1. 运行测试2. 构建文档3.

模版方法模式template method

学习笔记,原文链接 https://refactoringguru.cn/design-patterns/template-method 超类中定义了一个算法的框架, 允许子类在不修改结构的情况下重写算法的特定步骤。 上层接口有默认实现的方法和子类需要自己实现的方法