在使用SSM框架时出现错误Could not load driverClass com.mysql.cj.jdbc.Driver

在做SSM框架时链接数据库驱动出现错误

19-Nov-2019 08:44:54.101 璀﹀憡 [C3P0PooledConnectionPoolManager[identityToken->2rw00xa6ztpewuzf0x8d|304c437a]-HelperThread-#0] com.mchange.v2.c3p0.DriverManagerDataSource. Could not load driverClass com.mysql.cj.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1363)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1186)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mchange.v2.c3p0.DriverManagerDataSource.ensureDriverLoaded(DriverManagerDataSource.java:143)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:173)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
at com.mchange.v2.resourcepool.BasicResourcePool.access 700 ( B a s i c R e s o u r c e P o o l . j a v a : 44 ) a t c o m . m c h a n g e . v 2. r e s o u r c e p o o l . B a s i c R e s o u r c e P o o l 700(BasicResourcePool.java:44) at com.mchange.v2.resourcepool.BasicResourcePool 700(BasicResourcePool.java:44)atcom.mchange.v2.resourcepool.BasicResourcePoolScatteredAcquireTask.run(BasicResourcePool.java:1870)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

检查mysql版本问题

在pom文件中将mysql版本改为8以上
在使用SSM框架时出现错误Could not load driverClass com.mysql.cj.jdbc.Driver_第1张图片

改完之后出现错误

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.

解决方法:

在db.properties jdbcUrl=jdbc:mysql://localhost:3306/wuxh?characterEncoding=utf-8加上
&serverTimezone=UTC

在这里插入图片描述

你可能感兴趣的:(SSM)