再学习dubbo时,进行消费者测试的时候,直接报错:上提示:
Exception in thread “main” org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘orderServiceImpl’: Unsatisfied dependency expressed through field ‘userService’; nested exception is 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.atguigu.gmall.service.UserService. No provider available for the service com.atguigu.gmall.service.UserService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=order-service-consumer&dubbo=2.6.2&interface=com.atguigu.gmall.service.UserService&methods=getUserAddressList&pid=24476®ister.ip=192.168.2.2&revision=1.0-SNAPSHOT&s
很奇怪,我的bean并没有出错
后来发现,我在先开启服务者之后,再运行消费者中的mian,居然不报错,:上图:
再开启消费者:
虽然乱码,但是显示出来了,很是奇怪啊!!!按道理来说,运行了一个新的consumer之后,前一个mainapplication不是应该中止住吗?为什么我直接与运行不行,必须要先运行provider才可以,???不过在一想也有点理解,也可以理解为provider开启了之后,会被记录下来,再打开consumer后,前一个应用服务,即provider不会被关闭,而是继续与运行,其实我这个只是测试,真正运行中,一般都是不同服务器之间的这样相互调用,再模拟这种情况时,provider不会被关闭??
模模糊糊,希望有大佬可以指教,感激不尽!!!!!
dubbo报错: Error creating bean with name。。。。。
最新推荐文章于 2024-04-17 12:06:38 发布