dubbo服务报错service注册不上
一开始一直疑惑 为什么一模一样的代码 别人正常 我的代码就是运行不了,启动报错。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userController’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘EDoctorUserService’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.app.service.edoctor.EDoctorUserService. No provider available for the service com.app.service.edoctor.EDoctorUserService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.
报错信息 就是说service注册不上。试了网上的各种方法:
1.IP地址是否占用
2.service名称是否正确
3.zookper版本不正确
最后还是不对,同事推荐用dubbo控制台
控制台显示,28个服务,只有3个注册上了 为什么呢!
纠结了半天,最后发现是扫描包的问题,service 没扫描上。
在spring-mybatis.xml文件中加了
<context:component-scan base-package=“com.app.service” scoped-proxy=“interfaces”></context:component-scan>
这句话,发现就好了。
可是为什么同事没有这行代码 运行正常呢 还是很奇怪
我还是要好好研究dubbo