一、连接数据库的driver错误
1、提示:
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
原因:
com.mysql.jdbc.Driver已经不能用
解决办法:
url改成 com.mysql.cj.jdbc.Driver
二、连接数据库的url错误
2、提示:
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: The server time zone value ‘�й���ʱ��’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
解决办法:
在url代码后面添加?serverTimezone=UTC例如:
jdbc:mysql://localhost:3306/ssm_crud?serverTimezone=UTC
三、缺少依赖导致的错误
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
原因:
缺少slf4j和ibatis的依赖
解决:
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-nop</artifactId> <version>1.7.2</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.ibatis/ibatis-core --> <dependency> <groupId>org.apache.ibatis</groupId> <artifactId>ibatis-core</artifactId> <version>3.0</version> </dependency>
四、逆向工程生成位置路径错误
若运行没有文件生成,相对路径或绝对路径,可以改一下试试