Exception encountered during context initialization - cancelling refresh attempt

简介: Exception encountered during context initialization - cancelling refresh attempt:

Exception encountered during context initialization - cancelling refresh attempt:

org.springframework.beans.factory

e7d7d4b9b0c044a686f55c385972473a.png

默认类路径在spring-dao.xml

Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [spring-dao.xml]


上下文初始化期间遇到异常 - 取消刷新尝试:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory


看报错信息让我检查 com/wei/Mapper/UserMapper.xml

please check com/wei/Mapper/UserMapper.xml and file [D:\Java\Spring_Projects\Spring-10-mybatis\target\classes\com\wei\Mapper\UserMapper.xml]


总结:


得出错误出现在com/wei/Mapper/UserMapper.xml 中


检查UserMapper.xml 发现没有错误,只能去检查映射文件mybatis-config.xml 发现


UserMapper.xml中写了映射文件class加载方式

<mappers>

   <mapper class="com.wei.Mapper.UserMapper"/>

</mappers>

1

2

3

而spring-dao.xml中也书写了映射文件加载方式

<property name="mapperLocations" value="classpath:com/wei/Mapper/*.xml"/>

1

总结:


两处的映射文件加载方式冲突了,所以系统报错信息才会说defined in class path resource [spring-dao.xml]

d8aa5cbd15324707afae7868c01ad65d.png

c54338f8770e4b1998bf49e1b86699f8.png



目录
相关文章
getReader() has already been called for this request
getReader() has already been called for this request
1685 0
getReader() has already been called for this request
|
7月前
|
NoSQL 编译器 API
关于thread使用的错误:pure virtual method called terminate called without an active exception
关于thread使用的错误:pure virtual method called terminate called without an active exception
146 1
|
程序员
解决报错Exception encountered during context initialization
程序员不是在去生产bug的路上,那就是在去解决bug的路上。
153 1
|
7月前
|
应用服务中间件 nginx Windows
[emerg] 15060#200: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket ......
[emerg] 15060#200: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket ......
218 0
|
Java Maven Android开发
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
|
7月前
Error:Execution failed for task ':app:javaPreCompileDebug'. > Annotation processors must be explicit
Error:Execution failed for task ':app:javaPreCompileDebug'. > Annotation processors must be explicit
97 0
|
Java 数据库连接 数据库
【Java异常】Failed to determine a suitable driver class
【Java异常】Failed to determine a suitable driver class
471 0
|
Java Maven
An attempt was made to call a method that does not exist. The attempt was made from the following
An attempt was made to call a method that does not exist. The attempt was made from the following
480 0
|
Java Spring
【新手指南】严重: Exception sending context initialized event to listener instance of class
【新手指南】严重: Exception sending context initialized event to listener instance of class
540 0
【新手指南】严重: Exception sending context initialized event to listener instance of class
|
Java 应用服务中间件
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.