Failed to obtain JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: C
报错信息:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Per
报错信息:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is 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 org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class ‘com.mysql.jdbc.Driver’
The error may exist in com/dao/IUserDao.java (best guess)
The error may involve com.dao.IUserDao.userList
The error occurred while executing a query
- 由于我之前是访问Oracle数据库查询所有用户的文件。所有里面的jar包驱动是Oracle驱动的包,所以出现了这个错误,
解决办法
添加MySQL的驱动jar包即可。名称:mysql-connector-java-5.0.6-bin.jar,可以之前去mvn官网直接搜索下载你需要的版本。
添加MySQL驱动的jar包即可运行成功。
更多推荐
所有评论(0)