2016-11-15 50 views
0

我正在使用mysql作爲數據庫的應用程序和我的應用程序。因此,我在應用程序的WEB-INF/loib altinda中包含了mysql jar文件。仍然c3p0庫無法加載用於池的mysql數據庫驅動程序。Apache Tomcat無法加載Mysql驅動程序

> 2016-11-15 15:32:23,464 
> [C3P0PooledConnectionPoolManager[identityToken->188ezpw9ksw669r1vn17m6|1032a547]-HelperThread-#8] 
> DEBUG org.apache.catalina.loader.WebappClassLoader- 
> loadClass("com.mysql.jdbc.Driver", false) 2016-11-15 15:32:23,464 
> [C3P0PooledConnectionPoolManager[identityToken->188ezpw9ksw669r1vn17m6|1032a547]-HelperThread-#8] 
> DEBUG org.apache.catalina.loader.WebappClassLoader- Searching local 
> repositories 2016-11-15 15:32:23,464 
> [C3P0PooledConnectionPoolManager[identityToken->188ezpw9ksw669r1vn17m6|1032a547]-HelperThread-#8] 
> DEBUG org.apache.catalina.loader.WebappClassLoader-  
> findClass("com.mysql.jdbc.Driver") 2016-11-15 15:32:23,464 
> [C3P0PooledConnectionPoolManager[identityToken->188ezpw9ksw669r1vn17m6|1032a547]-HelperThread-#8] 
> DEBUG org.apache.catalina.loader.WebappClassLoader- Delegating to 
> parent classloader at end: 
> [email protected] Nov 15, 2016 
> 3:32:23 PM com.mchange.v2.log.slf4j.Slf4jMLog$Slf4jMLogger$WarnLogger 
> log WARNING: Could not load driverClass "com.mysql.jdbc.Driver" 
> java.lang.ClassNotFoundException: "com.mysql.jdbc.Driver"  at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) 
> at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) 
> at java.lang.Class.forName0(Native Method) at 
> java.lang.Class.forName(Class.java:190) 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(BasicResourcePool.java:44) at 
> com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870) 
> at 
> com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696) 

回答

1

如果你已經配置了通過JNDI你的數據庫連接,賠率是,駕駛員必須在tomcat/lib,而不是在webapp的lib目錄

+0

我的錯誤實際上是經過很長一段時間沒有java的我在字符串屬性的值周圍放置雙引號。這就是爲什麼它在抱怨。修復它現在正在工作的東西。 –

相關問題