dubbo异常:Failed to check the status of the service . No provider available for the service 解决

服务消费者调用报Failed to check the status of the service . No provider available for the service 这个问题 ,dubboadmin上边看服务正常启动 ,报错信息如下:
dubbo异常:Failed to check the status of the service . No provider available for the service 解决_第1张图片

Exception in thread “main” org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘demoService’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.alibaba.dubbo.demo.DemoService. No provider available for the service com.alibaba.dubbo.demo.DemoService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=demo-consumer&dubbo=2.5.3&interface=com.alibaba.dubbo.demo.DemoService&methods=sayHello&pid=98896&side=consumer×tamp=1565446380941 to the consumer 192.168.0.107 use dubbo version 2.5.3
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1647)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1215)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:257)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1085)
at com.alibaba.dubbo.demo.Consumer.main(Consumer.java:10)
Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.alibaba.dubbo.demo.DemoService. No provider available for the service com.alibaba.dubbo.demo.DemoService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=demo-consumer&dubbo=2.5.3&interface=com.alibaba.dubbo.demo.DemoService&methods=sayHello&pid=98896&side=consumer×tamp=1565446380941 to the consumer 192.168.0.107 use dubbo version 2.5.3
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:420)
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300)
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138)
at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171)
… 7 more

Process finished with exit code 1
问题解析:
可能出错的地方:
1、
提供者的XML配置如下:



消费者的XML配置:


经过反复查找原因终于锁定了生产者XML和消费者文件中的version=“1.0”

教训:如果生产者设定了服务的版本,消费者一定要提供相应的版本号;
如果生产者不设定了服务的版本,消费者一定不设置版本号;
两者必须保持一致;
2、如果pom.xml中dubbo去掉了spring的配置
pom.xml中加入spring-context对应的jar包
3、在网上有的说可能与服务提供者的@Service引入的jar包有关,经过本人测试,如果是使用xml的配置
加不加@Service这个注解不影响正常调用,即使加了@service注解,引入import org.springframework.stereotype.Service;或者import com.alibaba.dubbo.config.annotation.Service;不影响,都可以正常调用;
另外重写的方法加不加@Override注解也不影响

你可能感兴趣的:(Dubbo,dubbo)