<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: 2.7.1</li>
<li>Operating System version: Windows 10</li>
<li>Java version: 8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>clear USER_HOME/.dubbo directory</li>
<li>use multicast registry</li>
<li>run provider</li>
<li>run consumer</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">invoke success</h3>
<p dir="auto">What do you expected from the above steps？</p>
<h3 dir="auto">Failed to check the status of the service</h3>
<p dir="auto">What actually happens?<br>
see the code below(org.apache.dubbo.registry.multicast.MulticastRegistry#receive):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="private void receive(String msg, InetSocketAddress remoteAddress) {
        if (logger.isInfoEnabled()) {
            logger.info(&quot;Receive multicast message: &quot; + msg + &quot; from &quot; + remoteAddress);
        }
        if (msg.startsWith(Constants.REGISTER)) {
            URL url = URL.valueOf(msg.substring(Constants.REGISTER.length()).trim());
            registered(url);
        } else if (msg.startsWith(Constants.UNREGISTER)) {
            URL url = URL.valueOf(msg.substring(Constants.UNREGISTER.length()).trim());
            unregistered(url);
        } else if (msg.startsWith(Constants.SUBSCRIBE)) {
            URL url = URL.valueOf(msg.substring(Constants.SUBSCRIBE.length()).trim());
            Set&lt;URL&gt; urls = getRegistered();
            if (CollectionUtils.isNotEmpty(urls)) {
                for (URL u : urls) {
                    if (UrlUtils.isMatch(url, u)) {
                        String host = remoteAddress != null &amp;&amp; remoteAddress.getAddress() != null ? remoteAddress.getAddress().getHostAddress() : url.getIp();
                        if (url.getParameter(&quot;unicast&quot;, true) // Whether the consumer's machine has only one process
                                &amp;&amp; !NetUtils.getLocalHost().equals(host)) { // Multiple processes in the same machine cannot be unicast with unicast or there will be only one process receiving information
                            unicast(Constants.REGISTER + &quot; &quot; + u.toFullString(), host);
                        } else {
                            multicast(Constants.REGISTER + &quot; &quot; + u.toFullString());
                        }
                    }
                }
            }
        }/* else if (msg.startsWith(UNSUBSCRIBE)) {
        }*/
    }"><pre class="notranslate"><code class="notranslate">private void receive(String msg, InetSocketAddress remoteAddress) {
        if (logger.isInfoEnabled()) {
            logger.info("Receive multicast message: " + msg + " from " + remoteAddress);
        }
        if (msg.startsWith(Constants.REGISTER)) {
            URL url = URL.valueOf(msg.substring(Constants.REGISTER.length()).trim());
            registered(url);
        } else if (msg.startsWith(Constants.UNREGISTER)) {
            URL url = URL.valueOf(msg.substring(Constants.UNREGISTER.length()).trim());
            unregistered(url);
        } else if (msg.startsWith(Constants.SUBSCRIBE)) {
            URL url = URL.valueOf(msg.substring(Constants.SUBSCRIBE.length()).trim());
            Set&lt;URL&gt; urls = getRegistered();
            if (CollectionUtils.isNotEmpty(urls)) {
                for (URL u : urls) {
                    if (UrlUtils.isMatch(url, u)) {
                        String host = remoteAddress != null &amp;&amp; remoteAddress.getAddress() != null ? remoteAddress.getAddress().getHostAddress() : url.getIp();
                        if (url.getParameter("unicast", true) // Whether the consumer's machine has only one process
                                &amp;&amp; !NetUtils.getLocalHost().equals(host)) { // Multiple processes in the same machine cannot be unicast with unicast or there will be only one process receiving information
                            unicast(Constants.REGISTER + " " + u.toFullString(), host);
                        } else {
                            multicast(Constants.REGISTER + " " + u.toFullString());
                        }
                    }
                }
            }
        }/* else if (msg.startsWith(UNSUBSCRIBE)) {
        }*/
    }
</code></pre></div>
<p dir="auto">when consumer and provider in the same machine,</p>
<blockquote>
<p dir="auto">String host = remoteAddress != null &amp;&amp; remoteAddress.getAddress() != null ? remoteAddress.getAddress().getHostAddress() : url.getIp();</p>
</blockquote>
<p dir="auto">the host value maybe 127.0.0.1</p>
<blockquote>
<p dir="auto">NetUtils.getLocalHost()</p>
</blockquote>
<p dir="auto">maybe the actual ip adress such as 192.168.0.108<br>
then</p>
<blockquote>
<p dir="auto">url.getParameter("unicast", true) &amp;&amp; !NetUtils.getLocalHost().equals(host)</p>
</blockquote>
<p dir="auto">is true,and</p>
<blockquote>
<p dir="auto">unicast(Constants.REGISTER + " " + u.toFullString(), host)</p>
</blockquote>
<p dir="auto">is called, then only one process has received the information (in my test, it's consumer that does not receive the provider's register message), in this case when consumer call a rpc method, it will throw an exception</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Exception in thread &quot;main&quot; org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoServiceComponent': Injection of @org.apache.dubbo.config.annotation.Reference dependencies is failed; nested exception is java.lang.IllegalStateException: Failed to check the status of the service org.apache.dubbo.demo.DemoService. No provider available for the service org.apache.dubbo.demo.DemoService from the url multicast://224.5.6.7:1234/org.apache.dubbo.registry.RegistryService?application=dubbo-demo-annotation-consumer&amp;dubbo=2.0.2&amp;interface=org.apache.dubbo.demo.DemoService&amp;methods=sayHello&amp;pid=17400&amp;register.ip=192.168.0.108&amp;side=consumer&amp;timestamp=1548861796846 to the consumer 192.168.0.108 use dubbo version 
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.postProcessPropertyValues(AnnotationInjectedBeanPostProcessor.java:133)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1268)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
	at org.springframework.context.annotation.AnnotationConfigApplicationContext.&lt;init&gt;(AnnotationConfigApplicationContext.java:84)
	at org.apache.dubbo.demo.consumer.Application.main(Application.java:36)
Caused by: java.lang.IllegalStateException: Failed to check the status of the service org.apache.dubbo.demo.DemoService. No provider available for the service org.apache.dubbo.demo.DemoService from the url multicast://224.5.6.7:1234/org.apache.dubbo.registry.RegistryService?application=dubbo-demo-annotation-consumer&amp;dubbo=2.0.2&amp;interface=org.apache.dubbo.demo.DemoService&amp;methods=sayHello&amp;pid=17400&amp;register.ip=192.168.0.108&amp;side=consumer&amp;timestamp=1548861796846 to the consumer 192.168.0.108 use dubbo version 
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:398)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:306)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:230)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler.init(ReferenceAnnotationBeanPostProcessor.java:162)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler.access$100(ReferenceAnnotationBeanPostProcessor.java:146)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildInvocationHandler(ReferenceAnnotationBeanPostProcessor.java:140)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildProxy(ReferenceAnnotationBeanPostProcessor.java:122)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.doGetInjectedBean(ReferenceAnnotationBeanPostProcessor.java:116)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.doGetInjectedBean(ReferenceAnnotationBeanPostProcessor.java:49)
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.getInjectedObject(AnnotationInjectedBeanPostProcessor.java:342)
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor$AnnotatedFieldElement.inject(AnnotationInjectedBeanPostProcessor.java:522)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.postProcessPropertyValues(AnnotationInjectedBeanPostProcessor.java:129)
	... 12 more
Disconnected from the target VM, address: '127.0.0.1:59047', transport: 'socket'"><pre class="notranslate"><code class="notranslate">Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoServiceComponent': Injection of @org.apache.dubbo.config.annotation.Reference dependencies is failed; nested exception is java.lang.IllegalStateException: Failed to check the status of the service org.apache.dubbo.demo.DemoService. No provider available for the service org.apache.dubbo.demo.DemoService from the url multicast://224.5.6.7:1234/org.apache.dubbo.registry.RegistryService?application=dubbo-demo-annotation-consumer&amp;dubbo=2.0.2&amp;interface=org.apache.dubbo.demo.DemoService&amp;methods=sayHello&amp;pid=17400&amp;register.ip=192.168.0.108&amp;side=consumer&amp;timestamp=1548861796846 to the consumer 192.168.0.108 use dubbo version 
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.postProcessPropertyValues(AnnotationInjectedBeanPostProcessor.java:133)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1268)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
	at org.springframework.context.annotation.AnnotationConfigApplicationContext.&lt;init&gt;(AnnotationConfigApplicationContext.java:84)
	at org.apache.dubbo.demo.consumer.Application.main(Application.java:36)
Caused by: java.lang.IllegalStateException: Failed to check the status of the service org.apache.dubbo.demo.DemoService. No provider available for the service org.apache.dubbo.demo.DemoService from the url multicast://224.5.6.7:1234/org.apache.dubbo.registry.RegistryService?application=dubbo-demo-annotation-consumer&amp;dubbo=2.0.2&amp;interface=org.apache.dubbo.demo.DemoService&amp;methods=sayHello&amp;pid=17400&amp;register.ip=192.168.0.108&amp;side=consumer&amp;timestamp=1548861796846 to the consumer 192.168.0.108 use dubbo version 
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:398)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:306)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:230)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler.init(ReferenceAnnotationBeanPostProcessor.java:162)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler.access$100(ReferenceAnnotationBeanPostProcessor.java:146)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildInvocationHandler(ReferenceAnnotationBeanPostProcessor.java:140)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildProxy(ReferenceAnnotationBeanPostProcessor.java:122)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.doGetInjectedBean(ReferenceAnnotationBeanPostProcessor.java:116)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.doGetInjectedBean(ReferenceAnnotationBeanPostProcessor.java:49)
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.getInjectedObject(AnnotationInjectedBeanPostProcessor.java:342)
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor$AnnotatedFieldElement.inject(AnnotationInjectedBeanPostProcessor.java:522)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.postProcessPropertyValues(AnnotationInjectedBeanPostProcessor.java:129)
	... 12 more
Disconnected from the target VM, address: '127.0.0.1:59047', transport: 'socket'
</code></pre></div>
<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/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/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: macOS</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>构建spring标签</li>
</ol>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/12370508/72328795-9188cf00-36ee-11ea-8dc9-7632b1ec5f53.png"><img src="https://user-images.githubusercontent.com/12370508/72328795-9188cf00-36ee-11ea-8dc9-7632b1ec5f53.png" alt="image" style="max-width: 100%;"></a></p>
<ol start="2" dir="auto">
<li>
<p dir="auto">构建另一个类暴露提供者或者消费者<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/12370508/72328894-bf6e1380-36ee-11ea-9b7c-3a822da44b5c.png"><img src="https://user-images.githubusercontent.com/12370508/72328894-bf6e1380-36ee-11ea-9b7c-3a822da44b5c.png" alt="image" style="max-width: 100%;"></a></p>
</li>
<li>
<p dir="auto">结果出错<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/12370508/72328944-d876c480-36ee-11ea-9583-727fc55edf16.png"><img src="https://user-images.githubusercontent.com/12370508/72328944-d876c480-36ee-11ea-9583-727fc55edf16.png" alt="image" style="max-width: 100%;"></a></p>
</li>
</ol>
<p dir="auto">原因是该类在setApplication进行校验<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/12370508/72329050-03611880-36ef-11ea-9805-1cb1ecaea779.png"><img src="https://user-images.githubusercontent.com/12370508/72329050-03611880-36ef-11ea-9805-1cb1ecaea779.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">应用场景下，应用有自身application作为dubbo apllicaion，但是我们内部会让应用引用相关统计包，统计包则是使用自身的application来构建dubbo接口进行上传数据，这种场景应该比较场景，能否进行说明<br>
<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ulinkwo/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ulinkwo">@ulinkwo</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/justinmclean/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/justinmclean">@justinmclean</a></p>