org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection;
2017-07-10 18:03
477 查看
今天在自建一个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后面有空格,这样就会报上述错误,而且在这四条配置中,若后面有空格,都会报上述错误
### 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后面有空格,这样就会报上述错误,而且在这四条配置中,若后面有空格,都会报上述错误
相关文章推荐
- ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to chec
- Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nes
- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exc
- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection 原因
- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection
- Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nes
- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection解决办法
- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection
- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exc
- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons
- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection
- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection
- Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection;
- Oracle数据源:org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection;
- org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for
- org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for
- org.springframework.jdbc.CannotGetJdbcConnectionException【无解的jdbc.properties】
- org.springframework.jdbc.CannotGetJdbcConnectionException
- exceptions.JedisConnectionException: Could not get a resource from the pool at org.springframework.