在使用ssm框架中经常遇到创建bean错误的情况,下面会根据多种情况分析可能的原因和解决方案:
org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'categoryController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.e3mall.content.service.ContentCategoryService cn.e3mall.controller.CategoryController.contentCategoryService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentServiceImpl': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service cn.e3mall.content.service.ContentCategoryService. No provider available for the service cn.e3mall.content.service.ContentCategoryService from the url zookeeper://192.168.25.128:2181/com.alibaba.dubbo.registry.RegistryService?application=e3-manager-web&dubbo=2.5.3&interface=cn.e3mall.content.service.ContentCategoryService&methods=getContentCategoryList&pid=20016&revision=0.0.1-SNAPSHOT&side=consumer×tamp=1545183685747 to the consumer 192.168.25.1 use dubbo version 2.5.3
Error creating bean with name ‘categoryController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.e3mall.content.service.ContentCategoryService cn.e3mall.controller.CategoryController.contentCategoryService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘contentServiceImpl’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service cn.e3mall.content.service.ContentCategoryService. No provider available for the service cn.e3mall.content.service.ContentCategoryService from the url zookeeper://192.168.25.128:2181/com.alibaba.dubbo.registry.RegistryService?application=e3-manager-web&dubbo=2.5.3&interface=cn.e3mall.content.service.ContentCategoryService&methods=getContentCategoryList&pid=20016&revision=0.0.1-SNAPSHOT&side=consumer×tamp=1545183685747 to the consumer 192.168.25.1 use dubbo version 2.5.3
自动注入出错,不能注入这个service,根据下面的错误提示很明显可以看出是dubbo那一块报错,检查service服务已经发布出去
在dubbo的后台发现是没有提供者的,检查发现只有两个原来的20880的服务,还有一个20881的服务是没有的,检查发现service中没有配置spring初始化
配置完后重启看到服务已经发布
最后运行成功
描述的可能比较乱,这个报错的集中情况都经历了…有这个错没法解决的可以留言帮看