已解决org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persi
2023-09-27 14:27:32 时间
已解决org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persiste
报错问题
粉丝群里面的一个小伙伴敲代码时发生了报错(当时他心里瞬间凉了一大截,跑来找我求助,然后顺利帮助他解决了,顺便记录一下希望可以帮助到更多遇到这个bug不会解决的小伙伴),报错信息如下:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'æ´ªå¦æ·»'@'localhost' (using password: YES))
### The error may exist in com/ssm/mapper/UserMapper.xml
### The error may involve com.ssm.mapper.UserMapper.findUserById
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'æ´ªå¦æ·»'@'localhost' (using password: YES))
捕获到关键信息点:Failed to obtain JDBC Connection,意指JDBC连接失败,可能出现这个错误的地方,properties文件书写有误,需要先检查;如果仔细检查后没有问题,则继续检查是否发生命名冲突的问题。
解决方法
解决方法如下
对于原因2可以采取如下方法解决:
将原数据库配置文件properties
修改成:
最后在spring的配置文件中进行相应的更改即可。
福利
每周会送6本技术书籍包邮到家
由于博主时间精力有限,每天私信人数太多,没办法每个粉丝都及时回复
大家可以进社区裙或者添加博主微信
点击下方链接即可
http://t.csdn.cn/6kInJ
相关文章
- Spring Cloud Eureka 属性作用
- Spring Boot 第一个示例的 @RestController 和 @RequestMapping 注解
- spring集成Apache的ActiveMQ
- Spring-注解控件介绍
- Apache Log4j 爆核弹级漏洞,Spring Boot 默认日志框架就能完美躲过!!
- Spring Boot 2.5.4 发布,2.2.x 正式结束使命!
- Spring Boot 实现通用 Auth 认证的 4 种方式!
- Spring Boot 启动事件和监听器,太强大了!
- Spring 如何在一个事务中开启另一个事务?
- Spring中默认bean名称的生成策略/方式修改
- Spring Boot定时任务应用实践
- Bean复制的几种框架性能比较(Apache BeanUtils、PropertyUtils,Spring BeanUtils,Cglib BeanCopier)
- 深入理解spring注解之@ComponentScan注解
- Spring中的@Transactional(rollbackFor = Exception.class)属性详解
- 已解决org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection
- 问题排查之'org.apache.rocketmq.spring.starter.core.RocketMQTemplate' that could not be found.- Bean method 'rocketMQTemplate' in 'RocketMQAutoConfiguration' not loaded.
- 【Spring AOP】@Aspect结合案例详解(二): @Pointcut使用@within和within(已附源码)