apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.55k stars 26.44k forks source link

测试环境直连多个地址报错 #9908

Open LuSingTea opened 2 years ago

LuSingTea commented 2 years ago

测试环境直连多个地址报错

环境

配置

  1. spring-consumer.xml
    
    <dubbo:reference interface="com.demo.HelloApi" id="helloApi"
                              url="dubbo://192.168.137.100:20880;dubbo://192.168.137.101:20880"
                              group="test"/>
2. 报错信息

java.lang.ClassCastException: org.apache.dubbo.rpc.protocol.FilterNode cannot be cast to org.apache.rpc.cluster.support.migration.MigrationClusterInvoker at org.apache.dubbo.rpc.cluster.support.registry.ZoneAwareClusterInvoker.list(ZoneAwareClusterInvoker.java:127)


我看官方文档描述如果有多个地址则用分号隔开。如果只有一个地址运行不报错,如果有多个地址则报错
xxxcrel commented 2 years ago

dubbo默认使用ZoneAwareCluster集群方案, 直连多个Provider时应选用其他集群方案,如AvailableCluster, 至于产生这个异常的原因是因为ZoneAwareCluster里有关于迁移的一些特殊处理

xxxcrel commented 2 years ago
<dubbo:reference interface="com.demo.HelloApi" id="helloApi"
                              url="dubbo://192.168.137.100:20880;dubbo://192.168.137.101:20880"
                              cluster="available"
                              group="test"/>
LuSingTea commented 2 years ago

好的,我去试试看,谢谢