com.mchange.v2.c3p0.DriverManagerDataSource.ensureDriverLoaded - 不能加载driverClass oracle.jdbc.driver.OracleDriver

时间:2015-09-22 12:03:54

标签: spring hibernate

需要你的帮助。 我们正在为我们的应用程序使用hibernate,Spring,Oracle Db。 我们正在使用以下版本。

当我们尝试为Datasource加载Driver类时,那时我们得到了Exception。我们已经在类路径中添加了ojdbc14.jar,但它仍然提供了相同的异常。

 spring.version : 4.2.1.RELEASE
hibernate.version :5.0.1.Final
jackson.version :2.6.1
gson.version>2.3
log4j.version>1.2.17
org.apache.poi.version>3.10-FINAL
validation-api.version>1.1.0.Final


17:04:09 DEBUG [localhost-startStop-1] - com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool -Created new pool for auth, username (masked): 'DD******'.
17:04:09 DEBUG [localhost-startStop-1] - com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource -acquire test -- pool size: 0; target_pool_size: 10; desired target? 1
17:04:09 DEBUG [localhost-startStop-1] - com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable -awaitAvailable(): [unknown]
17:04:09 DEBUG [localhost-startStop-1] - com.mchange.v2.resourcepool.BasicResourcePool.trace -trace com.mchange.v2.resourcepool.BasicResourcePool@1cd5846 [managed: 0, unused: 0, excluded: 0]
17:04:09  WARN [C3P0PooledConnectionPoolManager[identityToken->2sp4cc9b1vxk7vaqqsqro|9ac35b]-HelperThread-#1] - com.mchange.v2.c3p0.DriverManagerDataSource.ensureDriverLoaded -Could not load driverClass oracle.jdbc.driver.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    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:112)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:144)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:195)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:184)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1086)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1073)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44)
    at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1810)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:648)
17:04:09  WARN [C3P0PooledConnectionPoolManager[identityToken->2sp4cc9b1vxk7vaqqsqro|9ac35b]-HelperThread-#0] - com.mchange.v2.c3p0.DriverManagerDataSource.ensureDriverLoaded -Could not load driverClass oracle.jdbc.driver.OracleDriver

1 个答案:

答案 0 :(得分:0)

您是否已将ojdbc14.jar文件放置在项目的lib文件夹中? 您设置了所需罐子的类路径吗?

还要检查它下面的内容..为我工作很久了

Run As -> Run configurations -> select your server from type filter text box

Then in Classpath under Bootstrap Entries add your classes12.jar File and Click on Apply.
Now, run the file

检查oracle.jdbc.driver.OracleDriver ClassNotFoundException类似