<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.4.1</li>
<li>Operating System version: ANY</li>
<li>Java version: ANY</li>
</ul>
<h3 dir="auto">Description</h3>
<p dir="auto">We started using "registry-multiple" for high availability of Registry Center, but found that "multiple-registry" configuration was not beautiful enough.<br>
We wish to transform like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;dubbo:registry protocol=&quot;multiple&quot;&gt;
    &lt;dubbo:child-registry key=&quot;z1&quot; protocol=&quot;zookeeper&quot; address=&quot;12.34.56.1:2181,12.34.56.2:2181,12.34.56.3:2181&quot;/&gt;
    &lt;dubbo:child-registry key=&quot;z2&quot; protocol=&quot;zookeeper&quot; address=&quot;12.34.56.4:2181&quot; register=&quot;false&quot;/&gt;&lt;!-- subscribe only--&gt;
    &lt;dubbo:child-registry key=&quot;r1&quot; protocol=&quot;redis&quot; address=&quot;9.8.7.6:3030&quot;/&gt;
&lt;/dubbo:registry&gt;"><pre class="notranslate"><code class="notranslate">&lt;dubbo:registry protocol="multiple"&gt;
    &lt;dubbo:child-registry key="z1" protocol="zookeeper" address="12.34.56.1:2181,12.34.56.2:2181,12.34.56.3:2181"/&gt;
    &lt;dubbo:child-registry key="z2" protocol="zookeeper" address="12.34.56.4:2181" register="false"/&gt;&lt;!-- subscribe only--&gt;
    &lt;dubbo:child-registry key="r1" protocol="redis" address="9.8.7.6:3030"/&gt;
&lt;/dubbo:registry&gt;
</code></pre></div>
<p dir="auto">And we have completed code.</p>
<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.6.2~2.7.3</li>
<li>Operating System version: Mac</li>
<li>Java version: JDK1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>Use GenericService to call $echo</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">Echo what you send.</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">Consumer：</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Failed to check the status of the service com.alibaba.dubbo.monitor.MonitorService. No provider available for the service hesc/com.alibaba.dubbo.monitor.MonitorService from the url zookeeper://192.168.99.51:2183/com.alibaba.dubbo.registry.RegistryService?application=dime-test&amp;dubbo=2.6.2&amp;generic=true&amp;group=hesc&amp;interface=com.alibaba.dubbo.monitor.MonitorService&amp;pid=92150&amp;register.ip=172.28.58.146&amp;side=consumer&amp;timestamp=1564539016305 to the consumer 172.28.58.146 use dubbo version 2.6.2"><pre class="notranslate"><code class="notranslate">Failed to check the status of the service com.alibaba.dubbo.monitor.MonitorService. No provider available for the service hesc/com.alibaba.dubbo.monitor.MonitorService from the url zookeeper://192.168.99.51:2183/com.alibaba.dubbo.registry.RegistryService?application=dime-test&amp;dubbo=2.6.2&amp;generic=true&amp;group=hesc&amp;interface=com.alibaba.dubbo.monitor.MonitorService&amp;pid=92150&amp;register.ip=172.28.58.146&amp;side=consumer&amp;timestamp=1564539016305 to the consumer 172.28.58.146 use dubbo version 2.6.2
</code></pre></div>
<p dir="auto">Producer: no $echo method error</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<p dir="auto"><em>Method method = ReflectUtils.findMethodByMethodSignature(invoker.getInterface(), name, types);</em></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="java.lang.NoSuchMethodException: com.alibaba.dubbo.monitor.MonitorService.$echo(java.lang.String)"><pre class="notranslate"><code class="notranslate">java.lang.NoSuchMethodException: com.alibaba.dubbo.monitor.MonitorService.$echo(java.lang.String)
</code></pre></div>
<p dir="auto">Code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@GetMapping(&quot;/test&quot;)
        public Result&lt;String&gt; test() {
            try {

                ReferenceConfig&lt;GenericService&gt; reference = new ReferenceConfig&lt;GenericService&gt;();
                // 弱类型接口名
                reference.setInterface(&quot;com.alibaba.dubbo.monitor.MonitorService&quot;);
                //                reference.setInterface(&quot;com.alibaba.dubbo.rpc.service.EchoService&quot;);
                // 声明为泛化接口 
                reference.setGeneric(true);

                ApplicationConfig applicationConfig = new ApplicationConfig();
                applicationConfig.setName(&quot;dime-test&quot;);
                reference.setApplication(applicationConfig);

                reference.setGroup(&quot;hesc&quot;);
                RegistryConfig registryConfig = new RegistryConfig();
                registryConfig.setAddress(&quot;zookeeper://192.168.99.51:2183?backup=192.168.99.37:2183&quot;);
                
                reference.setRegistry(registryConfig);

                // 用org.apache.dubbo.rpc.service.GenericService可以替代所有接口引用  
                GenericService genericService = reference.get();

                EchoService echoService = (EchoService) genericService;
                // 基本类型以及Date,List,Map等不需要转换，直接调用 
                Object result = genericService
                    .$invoke(&quot;$echo&quot;, new String[] { &quot;java.lang.String&quot; }, new Object[] { &quot;Haha&quot; });
                //                Object result = echoService.$echo(&quot;Haha&quot;);

                return Results.success(result.toString());
            } catch (Exception e) {
                return Results.error(e);
            }
        }"><pre class="notranslate"><code class="notranslate">@GetMapping("/test")
        public Result&lt;String&gt; test() {
            try {

                ReferenceConfig&lt;GenericService&gt; reference = new ReferenceConfig&lt;GenericService&gt;();
                // 弱类型接口名
                reference.setInterface("com.alibaba.dubbo.monitor.MonitorService");
                //                reference.setInterface("com.alibaba.dubbo.rpc.service.EchoService");
                // 声明为泛化接口 
                reference.setGeneric(true);

                ApplicationConfig applicationConfig = new ApplicationConfig();
                applicationConfig.setName("dime-test");
                reference.setApplication(applicationConfig);

                reference.setGroup("hesc");
                RegistryConfig registryConfig = new RegistryConfig();
                registryConfig.setAddress("zookeeper://192.168.99.51:2183?backup=192.168.99.37:2183");
                
                reference.setRegistry(registryConfig);

                // 用org.apache.dubbo.rpc.service.GenericService可以替代所有接口引用  
                GenericService genericService = reference.get();

                EchoService echoService = (EchoService) genericService;
                // 基本类型以及Date,List,Map等不需要转换，直接调用 
                Object result = genericService
                    .$invoke("$echo", new String[] { "java.lang.String" }, new Object[] { "Haha" });
                //                Object result = echoService.$echo("Haha");

                return Results.success(result.toString());
            } catch (Exception e) {
                return Results.error(e);
            }
        }
</code></pre></div>