congfig 配置如下:
public void configPlugin(Plugins me) {
C3p0Plugin cp = new C3p0Plugin(getProperty("jdbcUrl"),getProperty("user"),getProperty("password").trim());
//配置Oracle驱动
cp.setDriverClass("oracle.jdbc.driver.OracleDriver");
me.add(cp);
ActiveRecordPlugin arp = new ActiveRecordPlugin(cp);
me.add(arp);
// 配置Oracle方言
arp.setDialect(new OracleDialect());
// 配置属性名(字段名)大小写不敏感容器工厂
arp.setContainerFactory(new CaseInsensitiveContainerFactory());
arp.addMapping("person", "p_id", Person.class);
}
间隔一段时间循环报错误如下,但是不影响项目运行使用:
2016-12-06 15:09:50
[WARN]-[Thread: C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-AdminTaskTimer]-[com.mchange.v2.async.ThreadPoolAsynchronousRunner.processReplacedThreads()]: Task com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@c72d68 (in deadlocked PoolThread) failed to complete in maximum time 60000ms. Trying interrupt().
2016-12-06 15:09:50
[WARN]-[Thread: C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-AdminTaskTimer]-[com.mchange.v2.async.ThreadPoolAsynchronousRunner.processReplacedThreads()]: Task com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@5b0046 (in deadlocked PoolThread) failed to complete in maximum time 60000ms. Trying interrupt().
2016-12-06 15:10:00
[WARN]-[Thread: C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-AdminTaskTimer]-[com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector.run()]: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@1b47433 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2016-12-06 15:10:00
[WARN]-[Thread: C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-AdminTaskTimer]-[com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector.run()]: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@1b47433 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1d295de
on thread: C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-HelperThread-#2
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@6d625b
on thread: C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-HelperThread-#0
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1544abc
on thread: C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-HelperThread-#1
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@f6ae8f
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@13e6211
Pool thread stack traces:
Thread[C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-HelperThread-#1,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:152)
java.net.SocketInputStream.read(SocketInputStream.java:122)
oracle.net.ns.Packet.receive(Packet.java:300)
oracle.net.ns.DataPacket.receive(DataPacket.java:106)
oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)
oracle.net.ns.NetInputStream.read(NetInputStream.java:260)
oracle.net.ns.NetInputStream.read(NetInputStream.java:185)
oracle.net.ano.AnoComm.b(Unknown Source)
oracle.net.ano.AnoComm.o(Unknown Source)
oracle.net.ano.Ano.a(Unknown Source)
oracle.net.ano.Ano.negotiation(Unknown Source)
oracle.net.ns.NSProtocol.connect(NSProtocol.java:439)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Thread[C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-HelperThread-#2,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:152)
java.net.SocketInputStream.read(SocketInputStream.java:122)
oracle.net.ns.Packet.receive(Packet.java:300)
oracle.net.ns.DataPacket.receive(DataPacket.java:106)
oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)
oracle.net.ns.NetInputStream.read(NetInputStream.java:260)
oracle.net.ns.NetInputStream.read(NetInputStream.java:185)
oracle.net.ns.NetInputStream.read(NetInputStream.java:102)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:124)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:80)
oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1137)
oracle.jdbc.driver.T4C8TTIdty.receive(T4C8TTIdty.java:669)
oracle.jdbc.driver.T4C8TTIdty.doRPC(T4C8TTIdty.java:576)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1166)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Thread[C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-HelperThread-#0,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:152)
java.net.SocketInputStream.read(SocketInputStream.java:122)
oracle.net.ns.Packet.receive(Packet.java:300)
oracle.net.ns.DataPacket.receive(DataPacket.java:106)
oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)
oracle.net.ns.NetInputStream.read(NetInputStream.java:260)
oracle.net.ns.NetInputStream.read(NetInputStream.java:185)
oracle.net.ano.AnoComm.b(Unknown Source)
oracle.net.ano.AnoComm.o(Unknown Source)
oracle.net.ano.Ano.a(Unknown Source)
oracle.net.ano.Ano.negotiation(Unknown Source)
oracle.net.ns.NSProtocol.connect(NSProtocol.java:439)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
2016-12-06 15:11:00
[WARN]-[Thread: C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-AdminTaskTimer]-[com.mchange.v2.async.ThreadPoolAsynchronousRunner.processReplacedThreads()]: Task com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1544abc (in deadlocked PoolThread) failed to complete in maximum time 60000ms. Trying interrupt().
2016-12-06 15:11:00
[WARN]-[Thread: C3P0PooledConnectionPoolManager[identityToken->1b61hpq9k1mj7p9pjki3nn|1fd24c1]-AdminTaskTimer]-[com.mchange.v2.async.ThreadPoolAsynchronousRunner.processReplacedThreads()]: Task com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@6d625b (in deadlocked PoolThread) failed to complete in maximum time 60000ms. Trying interrupt().