启动nacos消费者,报错

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-05-22 10:11:32.101 ERROR 8652 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'registerController': Injection of @Reference dependencies is failed; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.greatdata.provider.api.UserService. No provider available for the service com.greatdata.provider.api.UserService:1.0.0 from the url nacos://106.54.187.185:8848/org.apache.dubbo.registry.RegistryService?application=business-register&dubbo=2.0.2&init=false&interface=com.greatdata.provider.api.UserService&methods=selectAll,insert&pid=8652&qos.enable=false&register.ip=192.168.227.1&release=2.7.6&revision=1.0.0&side=consumer&sticky=false&timestamp=1590113491502&version=1.0.0 to the consumer 192.168.227.1 use dubbo version 2.7.6
    at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessPropertyValues(AbstractAnnotationBeanPostProcessor.java:146) ~[spring-context-support-1.0.6.jar:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1427) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]

查看Dubbo提供者和消费者的写法
消费者
集成Nacos1.2.1和Dubbo2.7.6 消费者报错No provider available for the service1.png

提供者
集成Nacos1.2.1和Dubbo2.7.6 消费者报错No provider available for the service2.png

因为Dubbo的生成者能正常的注册.但是消费者提示无法注入@Reference,原因是新版dubbo生产和消费者没有注明group信息消费者,group=value("自定义") 但是生产者和消费者需要保持一致
集成Nacos1.2.1和Dubbo2.7.6 消费者报错No provider available for the service3.png

@Service(version = "1.0.0", group = "dubbo")

提供者
集成Nacos1.2.1和Dubbo2.7.6 消费者报错No provider available for the service4.png

@Reference(version = "1.0.0", group = "dubbo")

然后再次启动去nacos查看生产者和消费者都成功注册上去
集成Nacos1.2.1和Dubbo2.7.6 消费者报错No provider available for the service.png

Last modification:May 22, 2020
如果觉得这篇技术文章对你有用,请随意赞赏