我有一个配置了c3p0的maven项目,并且在运行项目时找不到负责连接数据库的驱动程序。我把jar驱动程序ojdbc6.jar
的jar放在glassfish上的lib / ext文件夹中,但没有任何改变。我在同一个glassfish上有另一个项目,通过这个驱动程序连接到同一个数据库,一切正常。
我收到以下错误:
Info: HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
Info: HHH000412: Hibernate Core {4.3.10.Final}
Info: HHH000205: Loaded properties from resource hibernate.properties: {hibernate.search.default.directory_provider=filesystem, hibernate.search.worker.execution=async, hibernate.c3p0.max_statements=50, hibernate.bytecode.use_reflection_optimizer=false, hibernate.jdbc.batch_size=1000, hibernate.c3p0.timeout=90, hibernate.generate_statistics=false, hibernate.search.analyzer=org.apache.lucene.analysis.core.KeywordAnalyzer, hibernate.auto_close_session=true, hibernate.c3p0.min_size=5, hibernate.connection.pool_size=5, hibernate.search.worker.batch_size=100, app.search.index.basedir=target/index, hibernate.search.default.exclusive_index_use=true, app.search.enable.false=false, hibernate.search.lucene_version=LUCENE_35, hibernate.c3p0.max_size=20, hibernate.c3p0.debugUnreturnedConnectionStackTraces=true, hibernate.connection.provider_class=org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider, hibernate.c3p0.unreturnedConnectionTimeout=90, hibernate.search.default.locking_strategy=simple}
Info: HHH000021: Bytecode provider name : javassist
Info: HHH000044: Configuring from URL: file:/C:/.../target/classes/hibernate.cfg.xml
Info: HHH000041: Configured SessionFactory: null
Info: HHH000130: Instantiating explicit connection provider: org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider
Info: HHH010002: C3P0 using driver: null at URL: null
Info: HHH000046: Connection properties: {}
Info: HHH000006: Autocommit mode: false
WARN: HHH000148: No JDBC Driver class was specified by property hibernate.connection.driver_class
Info: WARN 2017-11-20-11:39:23,779 BasicResourcePool.run(1851) | com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@3113673d -- 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.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:524)
at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:493)
at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
at java.sql.DriverManager.getDriver(DriverManager.java:262)
at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:240)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:131)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:156)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:145)
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)
有什么想法解决这个问题吗?