dubbo Failed to check the status of the service com.user.service.UserService. No provider available for the service


Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.user.service.UserService. No provider available for the service com.user.service.UserService from the url zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?application=userservice&dubbo=2.5.3&interface=com.user.service.UserService&methods=add&pid=39796&protocol=dubbo&side=consumer&timeout=15000&timestamp=1515132772468 to the consumer 10.100.130.245 use dubbo version 2.5.3

服務提供方:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<!--服務提供方服務信息-->
<dubbo:application name="userclient"/>

<!--注冊中心服務地址-->
<dubbo:registry id="zookeeper" protocol="zookeeper" address="${dubbo.registry.address}"/>

<!--用dubbo協議在30001-->
<dubbo:protocol name="dubbo" port="20880" dispather="all" threadpool="cached" threads="5000"/>
<!--聲明需要暴露的服務接口-->
<dubbo:service interface="com.user.service.UserService" ref="userService" version="1.0"
registry="zookeeper" owner="shp"/>
<!--具體服務接口實現-->
<bean id="userService" class="com.user.service.impl.userServiceImpl"/>
</beans>


消費者
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

<dubbo:application name="userservice"/>

<dubbo:registry id="zookeeper" protocol="zookeeper" address="${dubbo.registry.address}"/>
<dubbo:reference id="userService" interface="com.user.service.UserService" protocol="dubbo" timeout="15000"/>

</beans>

解決方案: 在 消費者配置文件 dubbo:reference 標簽添加 version="1.0",解決。

<dubbo:reference version="1.0" id="userService" interface="com.user.service.UserService" protocol="dubbo" timeout="15000"/>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM