Zookeeper is deployed on the server, and the consumer of the development machine cannot invoke the service of the producer of the development machine in the dubbo registry

1. My dubbo-admin and zookeeper are on the remote server, and then the dubbo producer and consumer are local to the developer. Start the producer project and you can see the successful registration in dubbo-admin. For the hosts file of the server, I have also set [public network ip] [hostname], and the server security group has also opened 2181 and 20880. However, when the consumer is started, it is found that the producer"s service cannot be invoked. May I ask how to solve the problem?

clipboard.png

Error starting ApplicationContext. To display the conditions report re-run your application with "debug" enabled.
2018-12-23 14:09:53.723 ERROR 5364 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name "dubboConsumerService" defined in file [D:\code\my\springboot-dubbo\consumer\target\classes\com\zjw\springboot\dubbo\consumer\service\DubboConsumerService.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: dubboConsumerService; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.zjw.springboot.dubbo.consumer.service.DemoService. No provider available for the service com.zjw.springboot.dubbo.consumer.service.DemoService:1.0 from the url zookeeper://120.78.140.117:2181/com.alibaba.dubbo.registry.RegistryService?application=consumer&dubbo=2.6.0&interface=com.zjw.springboot.dubbo.consumer.service.DemoService&methods=sendMessage&pid=5364&register.ip=192.168.0.106&revision=1.0&side=consumer&timestamp=1545545393342&version=1.0 to the consumer 192.168.0.106 use dubbo version 2.6.0
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:584) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at com.zjw.springboot.dubbo.consumer.ConsumerApplication.main(ConsumerApplication.java:15) [classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: dubboConsumerService; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.zjw.springboot.dubbo.consumer.service.DemoService. No provider available for the service com.zjw.springboot.dubbo.consumer.service.DemoService:1.0 from the url zookeeper://120.78.140.117:2181/com.alibaba.dubbo.registry.RegistryService?application=consumer&dubbo=2.6.0&interface=com.zjw.springboot.dubbo.consumer.service.DemoService&methods=sendMessage&pid=5364&register.ip=192.168.0.106&revision=1.0&side=consumer&timestamp=1545545393342&version=1.0 to the consumer 192.168.0.106 use dubbo version 2.6.0
    at com.alibaba.dubbo.spring.boot.DubboConsumerAutoConfiguration$1.postProcessBeforeInitialization(DubboConsumerAutoConfiguration.java:100) ~[dubbo-spring-boot-starter-2.0.0.jar:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1737) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    ... 14 common frames omitted
Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.zjw.springboot.dubbo.consumer.service.DemoService. No provider available for the service com.zjw.springboot.dubbo.consumer.service.DemoService:1.0 from the url zookeeper://120.78.140.117:2181/com.alibaba.dubbo.registry.RegistryService?application=consumer&dubbo=2.6.0&interface=com.zjw.springboot.dubbo.consumer.service.DemoService&methods=sendMessage&pid=5364&register.ip=192.168.0.106&revision=1.0&side=consumer&timestamp=1545545393342&version=1.0 to the consumer 192.168.0.106 use dubbo version 2.6.0
    at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:422) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:333) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:163) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:59) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.spring.boot.DubboConsumerAutoConfiguration$1.postProcessBeforeInitialization(DubboConsumerAutoConfiguration.java:89) ~[dubbo-spring-boot-starter-2.0.0.jar:na]
Mar.09,2022

Don't use the intranet IP, of your personal machine. Just use the extranet IP.


I was stupid because I didn't separate producers and consumers from using dubbo service interfaces for public use, and the producer's interface package name I wrote was different from the consumer's interface package name, so I definitely couldn't call = =.
although the zookeeper is deployed on a remote server, and the ip registered to the zookeeper by the producer is also a private network ip, it can still be called because the consumer and the producer are on the same private network.
if my producer is deploying another server, and if I do not configure that server hosts, and register with the producer's intranet IP, then the consumer will certainly not be able to call it. You can refer to this article about this. https://blog.csdn.net/xlgen15.

Menu