报错java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

来源:4-1 转账环境的搭建

冰玄_123

2018-12-18 14:21

我按照视频操作步骤进行到第一个demo1运行的时候总是报如下错误

2018-12-18 14:17:19.908 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] [WARN ]  com.mchange.v2.c3p0.DriverManagerDataSource {DriverManagerDataSource.java:107} - Could not load driverClass com.mysql.jdbc.Driver

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:169)

at com.mchange.v2.c3p0.DriverManagerDataSource.ensureDriverLoaded(DriverManagerDataSource.java:100)

at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:132)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)

at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)

at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)

at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)

2018-12-18 14:17:19.908 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] [WARN ]  com.mchange.v2.resourcepool.BasicResourcePool {BasicResourcePool.java:1841} - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1578aab -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 

java.sql.SQLException: No suitable driver

at java.sql.DriverManager.getDriver(DriverManager.java:264)

at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:223)

at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)

at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)

at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)

at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)


写回答 关注

2回答

  • STEVENNN
    2019-01-17 17:05:25

    少 jar

  • 慕粉3727937
    2018-12-20 14:48:28

    没有连接数据库的驱动

Spring事务管理

事务管理是Spring重要的知识,应用事务解决数据不一致问题

87318 学习 · 197 问题

查看课程

相似问题