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



目录
相关文章
|
JSON 前端开发 Java
RestfulToolKit:便捷的 IDEA 接口测试神器
RestfulToolKit:便捷的 IDEA 接口测试神器
4442 0
RestfulToolKit:便捷的 IDEA 接口测试神器
|
Java Linux Maven
解决jdk17启动seata报错的问题
解决jdk17启动seata报错的问题
4413 1
解决jdk17启动seata报错的问题
|
Java 数据库连接 mybatis
【Spring常见错误】No qualifying bean of type
📋📋 精彩摘要:MyBatis 核心配置文件(xxxConfig.xml),该文件配置了MyBatis的一些全局信息,,包含数据库连接信息和MyBatis运行时所需的各种特性,以及设置和响应MyBatis行为的一些属性。本文将深入浅出的介绍MyBatis核心配置文件中常用的标签配置。
7394 0
|
SpringCloudAlibaba NoSQL 安全
SpringCloudAlibaba篇(九)SpringCloudGateWay整合Oauth2+Jwt实现认证中心
SpringCloudAlibaba篇(九)SpringCloudGateWay整合Oauth2+Jwt实现认证中心
3205 0
SpringCloudAlibaba篇(九)SpringCloudGateWay整合Oauth2+Jwt实现认证中心
|
程序员
解决报错Exception encountered during context initialization
程序员不是在去生产bug的路上,那就是在去解决bug的路上。
532 1
|
12月前
|
安全 Java 编译器
我们来说一下 synchronized 与 ReentrantLock 的区别
我是小假 期待与你的下一次相遇 ~
460 4
springboot 集成 swagger 2.x 和 3.0 以及 Failed to start bean ‘documentationPluginsBootstrapper‘问题的解决
本文介绍了如何在Spring Boot项目中集成Swagger 2.x和3.0版本,并提供了解决Swagger在Spring Boot中启动失败问题“Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerEx”的方法,包括配置yml文件和Spring Boot版本的降级。
springboot 集成 swagger 2.x 和 3.0 以及 Failed to start bean ‘documentationPluginsBootstrapper‘问题的解决
|
监控 Java Linux
问题回顾:Unable to start web server; nested exception is org.springframework.boot.web.server.
解决“Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException”这一问题,关键在于细致的故障诊断和逻辑推理。从日志入手,逐步排查端口冲突、依赖问题、配置错误、资源限制、代码bug以及版本兼容性等多个方面,最终定位并解决根本原因。每一步操作都应谨慎且有针对性,确保修改一处后充分测试,避免引入新的问题。
4744 0
|
负载均衡 Java Nacos
Nacos注册中心有几种调用方式?
Nacos注册中心有几种调用方式?
552 2
Nacos注册中心有几种调用方式?