1. 程式人生 > >搭建SSM項目時報錯(org.springframework.jdbc.CannotGetJdbcConnectionException)

搭建SSM項目時報錯(org.springframework.jdbc.CannotGetJdbcConnectionException)

nec otg -s pass context mex justify highlight driver

嚴重: Servlet.service() for servlet [SpringMVC] in context with path [/ssm] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class ‘com.mysql.jdbc.Driver  ‘

在搭建SSM項目時報錯,一直提示Could not get JDBC Connection;

琢磨了好久才發現是jdbc.properties的文件寫錯了,如下:

driver=com.mysql.jdbc.Driver  
url=jdbc:mysql://localhost:3306/lin_test  
username=root  
password=123456  

在配置jdbc的時候,末尾不能有空格存在,要刪掉所有的多余空格

搭建SSM項目時報錯(org.springframework.jdbc.CannotGetJdbcConnectionException)