<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.7</li>
<li>Operating System version: windows 10</li>
<li>Java version: 1.8</li>
</ul>
<p dir="auto">现象：<br>
在测试cluster: zone-aware时，ZoneAwareClusterInvoker类的doInvoke方法抛出了java.lang.ClassCastException，异常信息为：<br>
java.lang.ClassCastException: org.apache.dubbo.registry.integration.RegistryDirectory$InvokerDelegate cannot be cast to org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker<br>
at org.apache.dubbo.rpc.cluster.support.registry.ZoneAwareClusterInvoker.doInvoke(ZoneAwareClusterInvoker.java:63)</p>
<p dir="auto">配置：<br>
<strong>Provider#1</strong><br>
server:<br>
port: 8090<br>
dubbo:<br>
scan:<br>
base-packages: cn.service.test.api<br>
application:<br>
name: dubbo-service<br>
config:<br>
multiple: true<br>
protocol:<br>
name: dubbo<br>
port: 2080<br>
threads: 200<br>
provider:<br>
version: 1.0.0<br>
registry:<br>
check: false<br>
timeout: 20000<br>
use-as-config-center: false<br>
address: zookeeper://localhost:2181<br>
zone: zone-1</p>
<p dir="auto"><strong>Provider#2</strong><br>
server:<br>
port: 8091<br>
dubbo:<br>
scan:<br>
base-packages: cn.service.test.api<br>
application:<br>
name: dubbo-service<br>
config:<br>
multiple: true<br>
protocol:<br>
name: dubbo<br>
port: 2081<br>
threads: 200<br>
provider:<br>
version: 1.0.0<br>
registry:<br>
check: false<br>
timeout: 20000<br>
use-as-config-center: false<br>
address: nacos://nacos.ym:80<br>
zone: zone-2</p>
<p dir="auto"><strong>Consumer</strong><br>
server:<br>
port: 8092<br>
dubbo:<br>
scan:<br>
base-packages: cn.service.test.api<br>
application:<br>
name: dubbo-client<br>
protocol:<br>
name: dubbo<br>
port: 2082<br>
threads: 200<br>
config:<br>
multiple: true<br>
provider:<br>
version: 1.0.0<br>
registries:<br>
zone1:<br>
address: zookeeper://localhost:2181<br>
timeout: 20000<br>
use-as-config-center: false<br>
cluster: zone-aware<br>
zone2:<br>
address: nacos://nacos.ym:80<br>
timeout: 20000<br>
preferred: true<br>
use-as-config-center: false<br>
cluster: zone-aware</p>
<p dir="auto">问题<br>
目前dubbo的文档中未发现zone-aware的使用方式，请问是配置错误导致吗？</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/incubator-dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/incubator-dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: all</li>
<li>Operating System version: all</li>
<li>Java version: all</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>create two ReferenceConfig for same service with different configuration.<br>
&lt;dubbo:reference id="demoService" interface="com.alibaba.dubbo.DemoService"&gt;<br>
&lt;/dubbo:reference&gt;<br>
&lt;dubbo:reference id="demoServiceAsync" interface="com.alibaba.dubbo.DemoService" async="true"&gt;<br>
&lt;/dubbo:reference&gt;</li>
<li>startup the consumer application.</li>
<li>get the ConsumerModel from ApplicationModel.</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">ApplicationModel.allConsumerModels() should returns two ConsumerModel.</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">ApplicationModel.allConsumerModels() only returns the first ConsumerModel.</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<p dir="auto">With future investigation, ReferenceConfig cannot put the second ConsumerModel as they are in same serviceName.</p>
<p dir="auto">Also, this is the same issue for provider with below configuration.<br>
<br>
&lt;dubbo:service interface="com.alibaba.dubbo.DemoService" ref="demoService"&gt;<br>
&lt;/dubbo:service&gt;<br>
<br>
&lt;dubbo:service interface="com.alibaba.dubbo.DemoService" ref="demoService2"&gt;<br>
&lt;/dubbo:service&gt;</p>
<p dir="auto">Here is my PR: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="365094989" data-permission-text="Title is private" data-url="https://github.com/apache/dubbo/issues/2582" data-hovercard-type="pull_request" data-hovercard-url="/apache/dubbo/pull/2582/hovercard" href="https://github.com/apache/dubbo/pull/2582">#2582</a></p>