【J】BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource
在做SSM博客系统的时候遇到以下报错:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource [applicationContext.xml
shiro有问题,所有的dao有问题
开始的时候以为是shiro的realm有问题,后来一步步排查,发现InitComponent类( implements ApplicationContextAware,用于项目启动时将一些信息保存到ApplicationContex中共享,如用户信息等)的setApplicationContext没有执行而直接执行了contextInitialized方法【也就是下图第一个断点未执行,直接跳到第二个断点】applicationContext为null,自然不能调用applicationContext.getBean()方法。
至于为何未执行,经过排除法(一步步删除写好的代码),发现是:
一个mapper的某个方法的resultMap写成了resultType
这个问题我用了12个小时才解决,至于为什么报这个错误?明明shiro的realm中用的bean blogger与出错的mapper对应的bean blogType没有直接关系。
估计后期学习ApplicationContextAware接口的原理才能真正理解
部分报错信息:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource [applicationContext.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor#0' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'securityManager' while setting bean property 'securityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'myRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myRealm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.yblog.service.BloggerService com.yblog.realm.MyRealm.bloggerService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bloggerService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.yblog.dao.BloggerDao com.yblog.service.impl.BloggerServiceImpl.bloggerDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.yblog.dao.BloggerDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Related cause: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'shiroFilter': Requested bean is currently in creation: Is there an unresolvable circular reference?
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blogDao' defined in file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\dao\BlogDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\mappers\BlogMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'blogResultMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: blogResultMap
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bloggerDao' defined in file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\dao\BloggerDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\mappers\BlogMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'blogResultMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: blogResultMap
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blogTypeDao' defined in file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\dao\BlogTypeDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\mappers\BlogMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'blogResultMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: blogResultMap
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commentDao' defined in file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\dao\CommentDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\mappers\BlogMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'blogResultMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: blogResultMap
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'linkDao' defined in file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\dao\LinkDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\mappers\BlogMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'blogResultMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: blogResultMap
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blogDao' defined in file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\dao\BlogDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\mappers\BlogMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'blogResultMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: blogResultMap
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bloggerDao' defined in file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\dao\BloggerDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\apache-tomcat-8.5.31-windows-64位\apache-tomcat-8.5.31\webapps\YBlog_war\WEB-INF\classes\com\yblog\mappers\BlogMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'blogResultMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: blogResultMap
【J】BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource相关推荐
- BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [
现场情景: 初次搭建springboot工程,原本要搭建一个springboot+mybatis的maven工程,听说springboot会把一切给配置好,天真的在执行完mybatis自动生成mapp ...
- 启动springboot报错Error creating bean with name 'dataSource' defined in class path resource
2019独角兽企业重金招聘Python工程师标准>>> 启动springboot报错Error creating bean with name 'dataSource' define ...
- 解决Error creating bean with name ‘redisConnectionFactory‘ defined in class path resource...问题
文章目录 1. 复现问题 2. 分析问题 3. 解决问题 1. 复现问题 今天在启动spring boot项目时,出现如下错误: org.springframework.beans.factory.B ...
- Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource [applicationContext
学习spring框架时遇到一个问题,找了很久. 记录一个错误, D:\Java\jdk-14.0.2\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1 ...
- 解决 Error creating bean with name ‘dataSource‘ defined in class path resource 问题
报错如下: java.lang.IllegalStateException: Failed to load ApplicationContextat org.springframework.test. ...
- Error creating bean with name ‘configurationPropertiesBeans‘ defined in class path resource异常分析
Error creating bean with name 'configurationPropertiesBeans' defined in class path resource异常分析 在学习使 ...
- Error creating bean with name 'servletEndpointRegistrar' defined in class path resource
记一次配置内容丢失导致报错问题:Error creating bean with name 'servletEndpointRegistrar' defined in class path resou ...
- seata:Error creating bean with name ‘globalTransactionScanner‘ defined in class path resource
错误描述 产生原因: 我idea默认用的是jdk17,在jdk17中很多类都弃用或者删了,切换成jdk8即可. 在spring整合seata时出现的错误,错误如下: Error starting Ap ...
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xm
报错信息如下: <span style="font-size:24px;">17:18:32,245 ERROR ContextLoader:307 - Context ...
最新文章
- oracle var/tmp,关于/var/tmp/.oracle 目录(ZT)
- Pulsar集群搭建部署
- 数据结构与算法 / 冒泡排序及其优化的三种方式
- [图文] Fedora 28 使用 Virt-Manager 创建 KVM 虚拟机以及 配置 KVM 虚拟机
- [aspnetcore.apidoc]一款很不错的api文档生成工具
- ReviewForJob——深度优先搜索的应用
- qt绘制一圈圆_Qt绘制圆
- python编程软件免费吗_MRT7-Python编程软件
- ActionScript 3 step by step (2) - 使用Trace()跟踪输出
- 【二分法】计蒜客:求方程的近似解
- 运维 如何选择最合适的服务器方案(一):服务器硬件配置
- remoting的Client如果访问IIS宿主server端要通过Firewall怎么办?
- 8.总线设备驱动模型
- 基于AHP(层次分析法)确定权值的模糊综合评价
- 单片机特殊知识总结(二)
- java font 字体大小_java的字体的颜色,型号,大小的方法
- 穿越技术火线,聆听内心声音——暨龙泉第三届IT禅修营
- php 长链接生成短链接
- python控制窗口_python小笔记-控制窗口的现实和隐藏
- Markdown 全文检索