ssm框架创建bean出错的汇总

本文总结了在使用SSM框架时遇到的bean创建错误问题,特别是与Dubbo服务注册相关的异常。内容包括:由于ContentCategoryService的autowired失败导致的BeanCreationException,以及在Dubbo后台发现服务提供者缺失的问题。解决方案涉及到检查并配置Spring初始化,确保服务已正确发布。通过这些步骤,最终成功解决了问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在使用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&timestamp=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&timestamp=1545183685747 to the consumer 192.168.25.1 use dubbo version 2.5.3

自动注入出错,不能注入这个service,根据下面的错误提示很明显可以看出是dubbo那一块报错,检查service服务已经发布出去
在这里插入图片描述
在dubbo的后台发现是没有提供者的,检查发现只有两个原来的20880的服务,还有一个20881的服务是没有的,检查发现service中没有配置spring初始化
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
配置完后重启看到服务已经发布

在这里插入图片描述
最后运行成功
在这里插入图片描述

描述的可能比较乱,这个报错的集中情况都经历了…有这个错没法解决的可以留言帮看

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值