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



目录
相关文章
|
2月前
|
NoSQL 编译器 API
关于thread使用的错误:pure virtual method called terminate called without an active exception
关于thread使用的错误:pure virtual method called terminate called without an active exception
18 1
|
18天前
|
Go
【已解决】SendTransactionVM Exception while processing transaction: Transaction‘s maxFeePerGas (200000000
【已解决】SendTransactionVM Exception while processing transaction: Transaction‘s maxFeePerGas (200000000
14 0
|
18天前
|
存储 缓存 自然语言处理
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】
13 1
|
12月前
|
程序员
解决报错Exception encountered during context initialization
程序员不是在去生产bug的路上,那就是在去解决bug的路上。
104 1
|
9月前
|
Java 数据库连接 数据库
【Java异常】Failed to determine a suitable driver class
【Java异常】Failed to determine a suitable driver class
221 0
|
9月前
|
Java Spring
BeanCreationException: Error creating bean with name ‘configurationPropertiesBeans‘ defined in class
BeanCreationException: Error creating bean with name ‘configurationPropertiesBeans‘ defined in class
118 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
301 0
|
Java Spring
【新手指南】严重: Exception sending context initialized event to listener instance of class
【新手指南】严重: Exception sending context initialized event to listener instance of class
386 0
【新手指南】严重: Exception sending context initialized event to listener instance of class
|
XML Java 数据库连接
【Error】:BeanCreationException: Error creating bean(Could not resolve resource location)
【Error】:BeanCreationException: Error creating bean(Could not resolve resource location)
312 0
【Error】:BeanCreationException: Error creating bean(Could not resolve resource location)
|
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.