dubbo报错Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.sea

When using dubbo, I wrote a simple SayHello for testing. When the service layer project and the presentation layer project were started respectively, the following error message appeared:

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 cn.feezu.carsearch.service.DemoService. No provider available for the service cn.feezu.carsearch.service.DemoService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=consumer-of-helloworld-app&default.timeout=5000&dubbo=2.5.3&interface=cn.feezu.carsearch.service.DemoService&methods=sayHello&pid=8148&side=consumer&timestamp=1440572169099 to the consumer 10.10.8.101 use dubbo version 2.5.3  
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:151)  
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)  
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1514)  
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:252)  
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)  
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973)  
    at Main.main(Main.java:15)  
Caused by: java.lang.IllegalStateException: Failed to check the status of the service cn.feezu.carsearch.service.DemoService. No provider available for the service cn.feezu.carsearch.service.DemoService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=consumer-of-helloworld-app&default.timeout=5000&dubbo=2.5.3&interface=cn.feezu.carsearch.service.DemoService&methods=sayHello&pid=8148&side=consumer&timestamp=1440572169099 to the consumer 10.10.8.101 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:144)  
    ... 6 more  

Reason: It is caused by the inconsistency of the version numbers in the xml configuration files of the producer and the consumer. Either the two configuration files have the following version information, or neither is written, and needs to be unified

<?xml version="1.0" encoding="UTF-8"?>

The xml file configuration of the producer is as follows:

<?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="demo-consumer"/>    
         <dubbo:registry address="zookeeper://192.168.56.121:2181" /> 
         
         <dubbo:reference id="helloT" interface="com.searchservice.test.service.HelloT" version="1.0"/> 
        
         <dubbo:reference id="errorAnalyDao" interface="com.searchservice.youmeng.dao.ErrorAnalyDao" version="1.0"/> 
          
         
</beans>  

The consumer's xml file configuration is as follows:

<?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:protocol name="dubbo" port="20880"></dubbo:protocol>        
       <dubbo:application name="dubbo-service-test"/>    	
       <dubbo:registry address="zookeeper://192.168.56.121:2181" />  	
       	
       <dubbo:service interface="com.searchservice.test.service.HelloT" ref="helloImpl" version="1.0" />  
	   <bean id="helloImpl" class="com.searchservice.test.service.impl.HelloImpl"/> 
      

</beans> 

If this is not the problem, it is recommended to check whether it is a firewall problem, it is recommended to turn off and try

Guess you like

Origin blog.csdn.net/Poolweet_/article/details/108630397