Does "zone-aware" cluster(ZoneClusterInvoker) work ?
Environment
- Dubbo version: 2.7.12
- Operating System version: win10
- Java version: 1.8
Steps to reproduce this issue
- start provider-1 registried in zk-1
- start provider-2 registried in zk-2
- start consumer refer the provider on zk-1 and zk-2(preferred=true)
- consumer refer interface of the provider failed with the following error:
[28/06/21 17:06:36:663 CST] SpringContextShutdownHook INFO zookeeper.ZookeeperRegistry: [DUBBO] Destroy unregister url consumer://172.19.192.1/org.apache.dubbo.demo.DemoService?application=demo-consumer&category=consumers&check=false&cluster=zone-aware&dubbo=2.0.2&init=false&interface=org.apache.dubbo.demo.DemoService&metadata-type=remote&methods=sayHello,sayHelloAsync&pid=4836&qos.port=33333&release=2.7.11&side=consumer&sticky=false×tamp=1624871181015, dubbo version: 2.7.11, current host: 172.19.192.1 Exception in thread "main" java.lang.ClassCastException: org.apache.dubbo.registry.integration.RegistryDirectory$InvokerDelegate cannot be cast to org.apache.dubbo.rpc.cluster.ClusterInvoker at org.apache.dubbo.rpc.cluster.support.registry.ZoneAwareClusterInvoker.doInvoke(ZoneAwareClusterInvoker.java:77) at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:265) at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47) at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92) at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47) at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92) at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:93) at org.apache.dubbo.registry.client.migration.MigrationInvoker.invoke(MigrationInvoker.java:169) at org.apache.dubbo.rpc.cluster.support.registry.ZoneAwareClusterInvoker.doInvoke(ZoneAwareClusterInvoker.java:105) at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:265) at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47) at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92) at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47) at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92) at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:93) at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:96) at org.apache.dubbo.common.bytecode.proxy0.sayHelloAsync(proxy0.java) at org.apache.dubbo.demo.consumer.Application.main(Application.java:34)
-
the config of the consumer is :
<dubbo:application name="demo-consumer"/>
<dubbo:consumer cluster="zone-aware"/>
<dubbo:registry id="r1" address="zookeeper://192.168.132.193:2181" preferred="true" timeout="25000"/>
<dubbo:registry id="r2" address="zookeeper://192.168.132.194:2181" timeout="25000"/>
<dubbo:reference id="demoService" check="false" interface="org.apache.dubbo.demo.DemoService" registry="r1,r2"/>
Does the zone-aware cluster work? Is the config right?
Try it with the latest version, if you still have problems, you can reopen the issue