##问题描述
###异常1
[org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext:559] -- Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'shiroFilter' defined in class path resource [com/dhcc/upsr/manage/sys/auth/shiro/config/ShiroConfig.class]:
Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.spring.web.ShiroFilterFactoryBean]: Factory method 'shiroFilter' threw exception;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [com/dhcc/upsr/manage/sys/auth/shiro/config/ShiroConfig.class]:
Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.mgt.SecurityManager]:
Factory method 'securityManager' threw exception;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'primaryRealm': Unsatisfied dependency expressed through field 'sysUserInfoService';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'sysUserInfoService':
Unsatisfied dependency expressed through field 'sysUserInfoDao';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'sysUserInfoDao' defined in URL [jar:file:/home/upsr/instance/ms-batch-1.0.0-SNAPSHOT.jar!/BOOT-INF/lib/ms-auth-0.1.0-SNAPSHOT.jar!/com/dhcc/upsr/manage/sys/user/dao/SysUserInfoDao.class]:
Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [tk/mybatis/mapper/autoconfigure/MapperAutoConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception;
nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'class path resource [auth/db-mapper/oracle/sys/SysDataSourseDetailMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'class path resource [auth/db-mapper/oracle/sys/SysDataSourseDetailMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.dhcc.upsr.manage.sys.datasource.dao.SysDataSourceDetailDao.BaseResultMap
先对异常信息进行一个层次分离;对于异常,我们首先要去查看Caused 或者Caused by 后面的内容,一般就是真正报错的原因
所以上面抽取出来就是:
Cause: java.lang.IllegalArgumentException:
Result Maps collection already contains value for
com.dhcc.upsr.manage.sys.datasource.dao.SysDataSourceDetailDao.BaseResultMap
####首先类型:
java.lang.IllegalArgumentException–非法数据异常
####具体信息:
Result Maps collection already contains value for
就是映射集合里面已经包含SysDataSourceDetail对象的映射
####解决:
就根据对象信息:com.dhcc.upsr.manage.sys.datasource.dao.SysDataSourceDetailDao.BaseResultMap
全局搜索看是否其他地方有相同的SysDataSourceDetail信息即解决
###异常2
Caused by:
org.springframework.context.annotation.ConflictingBeanDefinitionException:
Annotation-specified bean name 'upsrDictDtlService' for bean class
[com.dhcc.upsr.manage.parm.dict.service.impl.UpsrDictDtlServiceImpl]
conflicts with existing, non-compatible bean definition of same name and class
[com.dhcc.upsr.manage.cache.service.impl.UpsrDictDtlServiceImpl]
####首先类型:
org.springframework.context.annotation.ConflictingBeanDefinitionException
这是Bean定义冲突,就是有两个相同名字的类
####具体信息:
Annotation-specified bean name ‘upsrDictDtlService’ for bean class
这里可以知道重复的Bean的名字为upsrDictDtlService
后面跟的是两个Bean的包路径,直接去找即可