dubbo multicast 连接失败解决方案

版权声明:本文为博主原创文章,欢迎转载,转载请注明作者、原文超链接。 https://blog.csdn.net/axing2015/article/details/81433678

一、异常信息

Exception in thread "main" com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method sayHello in the service com.demo.service.DemoService. No provider available for the service com.demo.service.DemoService:1.0 from registry 224.5.6.7:1234 on the consumer 10.10.10.1 using the dubbo version 2.5.3. Please check if the providers have been started and registered.

Exception in thread "main" com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method sayHello in the service com.demo.service.DemoService. No provider available for the service com.demo.service.DemoService:1.0 from registry 224.5.6.7:1234 on the consumer 10.10.10.1 using the dubbo version 2.5.3. Please check if the providers have been started and registered.
	at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.checkInvokers(AbstractClusterInvoker.java:246)
	at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:55)
	at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:227)
	at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:72)
	at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52)
	at com.alibaba.dubbo.common.bytecode.proxy0.sayHello(proxy0.java)
	at com.demo.consumer.Consumer.main(Consumer.java:21)

二、异常原因以及解决方案

原因一:使用端和广播端的xxxService类名以及路径不匹配

<!-- 广播端:xxxService 以及 version 必须与使用端一致-->
<dubbo:service interface="com.demo.service.DemoService" ref="demoService" version="1.0"/>
<!-- 使用端:xxxService 以及 version 必须与广播端一致-->
<dubbo:reference id="demoService" check="false" interface="com.demo.service.DemoService" version="1.0"/>

原因二:使用端和广播端的广播地址不匹配

<!-- 广播端:使用 multicast 广播注册中心暴露服务地址 (224.0.0.0 - 239.255.255.255) -->
<dubbo:registry address="multicast://224.5.6.7:1234?unicast=false"/>
<!-- 使用端:配置服务注册中心,必须有广播端一致 -->
<dubbo:registry address="multicast://224.5.6.7:1234?unicast=false"/>

原因三:该地址在网络中已被占用;改用其他地址(224.0.0.0-239.255.255.255之间)

注:如果还不好用,可以直接改成直连

<!-- 广播端:直连模式 -->
<dubbo:registry address="N/A"/>
<!-- 使用端:直连模式 在 dubbo:reference中 加上url="dubbo://127.0.0.1:20880" -->
<dubbo:reference id="demoService" check="false" interface="com.demo.service.DemoService" version="1.0" url="dubbo://127.0.0.1:20880"/>

猜你喜欢

转载自blog.csdn.net/axing2015/article/details/81433678
今日推荐