SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1fa5519] was not registered for syn...

 

 

 

Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1fa5519] was not registered for synchronization because synchronization is not active

开发环境:Spring4.3.6 + MyBatis3.4.2 + MySQL5.7
抛出这个提示,不明就里,不知道哪里出现了异常,但是执行到 MyBatis 的 UserDao 中的 saveUser 方法时比较慢,于是将此段代码 try{}catch(),报出如下异常:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.alibaba.druid.pool.DataSourceDisableException
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.alibaba.druid.pool.DataSourceDisableException

这就明确了问题的症结,是由于 com.alibaba.druid 连接池引起的,由于之前项目中用的 Spring 版本是 3.x 的,本项目用的是 Spring4.x 的,故推测 druid 版本问题,于是将 druid 的版本由 0.2.26 升级为 0.2.26 解决了此问题。

转载于:https://www.cnblogs.com/hapday/p/6406842.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值