已解决org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persiste

完美解决org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Per_解决方法


文章目录

  • 报错问题
  • 解决方法
  • 声明


报错问题

粉丝群里面的一个小伙伴敲代码时发生了报错(当时他心里瞬间凉了一大截,跑来找我求助,然后顺利帮助他解决了,顺便记录一下希望可以帮助到更多遇到这个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文件书写有误,需要先检查;如果仔细检查后没有问题,则继续检查是否发生命名冲突的问题。

完美解决org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Per_mybatis_02

解决方法

解决方法如下

完美解决org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Per_bc_03


对于原因2可以采取如下方法解决:

将原数据库配置文件properties

完美解决org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Per_bc_04


修改成:

完美解决org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Per_bc_05


最后在spring的配置文件中进行相应的更改即可。

声明

解决方法参考网络,如有侵权联系我删除