在使用dubbo,分别启动服务层工程和表现层工程的时候,tomcat出现以下报错信息:
Caused by: java.lang.IllegalStateException: Failed to check the status of the service cn.campus.service.ItemService. No provider available for the service cn.campus.service.ItemService from the url zookeeper://192.168.17.129:2181/com.alibaba.dubbo.registry.RegistryService?application=campus-manager-web&dubbo=2.5.3&interface=cn.campus.service.ItemService&methods=getItemList&pid=15668&revision=0.0.1-SNAPSHOT&side=consumer&timeout=30000×tamp=1549955576947 to the consumer 192.168.17.1 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:168)
... 43 more
并且dubbo监控中心显示没有提供者
原因:是由于生产者和消费者的xml配置文件中的版本号不一致导致的,要么两个配置文件都有以下version信息,要么都不写,需要统一。
<?xml version="1.0" encoding="UTF-8"?>
解决方案:将生产者和消费者配置文件均加上以上头信息。
解决后刷新监控中心,可以看到服务正常