org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection;

今天在自建一个maven web项目,在进行测试的时候,报错,详细信息如下:

### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; 
nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory 
(Access denied for user 'root'@'localhost' (using password: YES))
### The error may exist in file [E:\work_pratise\happyrunning\happyrunning\target\classes\com\zxc\happy\mapping\UserMapper.xml]
### The error may involve com.zxc.happy.dao.UserMapper.selectByPrimaryKey
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.
SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))

网上遇到此问题的好多帖子,更多的是表示配置出问题,参考链接如下:

http://blog.csdn.net/liwuyang2013/article/details/25986597

http://blog.csdn.net/cool_easy/article/details/42913811

检查jdbc.properties的配置,路径以及用户密码都没有问题,驱动类jar包也有,后来仔细检查,发现在配置文件:

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/running_man?useUnicode=true&characterEncoding=utf8
jdbc.username=root
jdbc.password=root 
jdbc.password=root后面有空格,这样就会报上述错误,而且在这四条配置中,若后面有空格,都会报上述错误

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值