Coder Social home page Coder Social logo

swaldman / c3p0 Goto Github PK

View Code? Open in Web Editor NEW
1.3K 1.3K 335.0 4.27 MB

a mature, highly concurrent JDBC Connection pooling library, with support for caching and reuse of PreparedStatements.

Home Page: http://www.mchange.com/projects/c3p0

License: Other

Java 97.66% Roff 0.85% Scala 1.49%
connection-management connection-pool connection-pooling java jdbc

c3p0's People

Contributors

jdsumsion avatar swaldman avatar wbrauneis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

c3p0's Issues

"A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@f03f0af -- timeout at awaitAvailable()"

I'm running a Java Play v1.3.x app using MySQL Connector/J v5.1.29 on Heroku that connects to an AWS RDS MySQL Tiny instance within the same availability zone (us-east-1). I continually see a connection timeouts as below when starting up the application. The checkout timeout has been 5sec (the default) but which I've now increased to 7sec. I wouldn't expect it to take more than 5sec to acquire a connection within the same availability zone. I'm not sure if this is an AWS issue, a Heroku issue or a c3p0 issues or a combination. I just want to check that this can be resolved by simply increasing the checkout timeout value or there could possibly be another issue. Thanks, Chris.

02-03-14 02:33:21,661 [main] ERROR play
Cannot connected to the database : An attempt by a client to checkout a Connection has timed out.
java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
        at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
        at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77)
        at play.db.DBPlugin.onApplicationStart(DBPlugin.java:147)
        at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:525)
        at play.Play.start(Play.java:537)
        at play.Play.init(Play.java:309)
        at play.server.Server.main(Server.java:166)
Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@f03f0af -- timeout at awaitAvailable()
        at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1416)
        at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:606)
        at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:526)
        ... 5 more

MaxPoolSize not honored if below MinPoolSize

Call setMaxPoolSize(1); on an otherwise un-configured ComboPooledDataSource and you can still get 3 (in my case) connections. I expected to be restricted to one. The problem is not fixed by also calling setInitialPoolSize(1) but it is fixed by also calling setMinPoolSize(1).

It might be nice if each of these checked the other values and adjusted them to avoid unexpected results: setMinPoolSize(n) could internally call setMaxPoolSize(Math.max(n, getMaxPoolSize)) to make sure the max is not less than the min, and so on.

In case it seems too perverse to use a pool of one, I use both Postgres and SQLite and my multithreaded code is mostly agnostic about which it's given. A pool size of one allows me to force a single writer on SQLite connections (but multiple on Postgres) without having to rewrite anything outside the connection sharing code.

Any error in Postgres transaction causes C3P0 to close connections

Consider this postgres session

postgres=# create table temp (id int primary key);
CREATE TABLE
postgres=# begin
postgres-# ;
BEGIN
postgres=# insert into temp values(1);
INSERT 0 1
postgres=# insert into temp values(1);
ERROR:  duplicate key value violates unique constraint "temp_pkey"
DETAIL:  Key (id)=(1) already exists.
postgres=# select * from temp;
ERROR:  current transaction is aborted, commands ignored until end of transaction block
postgres=# select * from temp;
ERROR:  current transaction is aborted, commands ignored until end of transaction block
postgres=# 

This means that basically after any error a session is put in an aborted state and any query that is ran afterwards (other than ROLLBACK either complete or to a savepoint). The issue is that C3P0 in reponse to the error (e.g. contraint violation) goes into NewPooledConnection.handleThrowable, which goes on to test the state of the connection by... issuing a test query. This works on Oracle, but reports an error in postgres as demonstrated above, which causes the connection to be marked invalid. This is actually shown in the logs:

[17:06:36.170] DEBUG com.mchange.v2.c3p0.impl.DefaultConnectionTester  - Connection org.postgresql.jdbc4.Jdbc4Connection@5d4aa6eb failed Connection test with an Exception! [query=select 1] org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
17:06:36.170] DEBUG com.mchange.v2.c3p0.impl.NewPooledConnection  - com.mchange.v2.c3p0.impl.NewPooledConnection@5596211f inva
lidated by Exception.
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "foo"
[17:06:36.171] DEBUG com.mchange.v2.resourcepool.BasicResourcePool  - Excluded resource com.mchange.v2.c3p0.impl.NewPooledConnection@5596211f
[17:06:36.172] DEBUG com.mchange.v2.resourcepool.BasicResourcePool  - Preparing to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@5596211f
[17:06:36.172] DEBUG com.mchange.v2.c3p0.impl.NewPooledConnection  - com.mchange.v2.c3p0.impl.NewPooledConnection@5596211f closed by a client.
java.lang.Exception: DEBUG -- CLOSE BY CLIENT STACK TRACE

Note: I believe that this is postgres specific, I tested it on Oracle, and Oracle allows further queries to be executed after such a constraint violation.

Options for resolving:

  1. have a specialized ConnectionTester implementation for Postgres, which would either not test the connection at all after constraint violation, or do a rollback itself (VERY ugly and I would not recommend it)
  2. rethink the idea of checking connection status in response to any exception, maybe some subset of exceptions (like the constraint violations) do not require checking of the connection status?

c3p0 deadlock issue

Hi,

I found a c3p0 deadlock issue in my project recently. My c3po is 0.9.2.1 version.

Here is the jstack message of the deadlock. Please help about this problem.

Thanks,
Chao

Found one Java-level deadlock:

"C3P0PooledConnectionPoolManager[identityToken->31b6y68u1at2f6m11v89lr|40e99ce5]-HelperThread-#1":
waiting to lock monitor 0x0000000052139e50 (object 0x00000007042a19d8, a com.mysql.jdbc.JDBC4ResultSet),
which is held by "C3P0PooledConnectionPoolManager[identityToken->31b6y68u1at2f6m11v89lr|40e99ce5]-HelperThread-#0"
"C3P0PooledConnectionPoolManager[identityToken->31b6y68u1at2f6m11v89lr|40e99ce5]-HelperThread-#0":
waiting to lock monitor 0x0000000052f63440 (object 0x00000007042541b8, a com.mysql.jdbc.JDBC4Connection),
which is held by "C3P0PooledConnectionPoolManager[identityToken->31b6y68u1at2f6m11v89lr|40e99ce5]-HelperThread-#1"

Java stack information for the threads listed above:

"C3P0PooledConnectionPoolManager[identityToken->31b6y68u1at2f6m11v89lr|40e99ce5]-HelperThread-#1":
at com.mysql.jdbc.ResultSetImpl.realClose(ResultSetImpl.java:7195)

  • waiting to lock <0x00000007042a19d8> (a com.mysql.jdbc.JDBC4ResultSet)
    at com.mysql.jdbc.ResultSetImpl.close(ResultSetImpl.java:909)
    at com.mysql.jdbc.StatementImpl.realClose(StatementImpl.java:2478)
  • locked <0x00000007042a1a88> (a com.mysql.jdbc.StatementImpl)
    at com.mysql.jdbc.ConnectionImpl.closeAllOpenStatements(ConnectionImpl.java:1628)
    at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4388)
    at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1601)
  • locked <0x00000007042541b8> (a com.mysql.jdbc.JDBC4Connection)
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:629)
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:259)
  • locked <0x0000000704255ba0> (a com.mchange.v2.c3p0.impl.NewPooledConnection)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:619)
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1024)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:648)
    "C3P0PooledConnectionPoolManager[identityToken->31b6y68u1at2f6m11v89lr|40e99ce5]-HelperThread-#0":
    at com.mysql.jdbc.ConnectionImpl.getCharacterSetMetadata(ConnectionImpl.java:2851)
  • waiting to lock <0x00000007042541b8> (a com.mysql.jdbc.JDBC4Connection)
    at com.mysql.jdbc.Field.getStringFromBytes(Field.java:717)
    at com.mysql.jdbc.Field.getOriginalName(Field.java:659)
    at com.mysql.jdbc.ResultSetImpl.buildIndexMapping(ResultSetImpl.java:751)
    at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1110)
  • locked <0x00000007042a19d8> (a com.mysql.jdbc.JDBC4ResultSet)
    at com.mysql.jdbc.DatabaseMetaData$9.forEach(DatabaseMetaData.java:5059)
    at com.mysql.jdbc.IterateBlock.doForAll(IterateBlock.java:51)
    at com.mysql.jdbc.DatabaseMetaData.getTables(DatabaseMetaData.java:4991)
    at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnectionNoQuery(DefaultConnectionTester.java:197)
    at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:74)
    at com.mchange.v2.c3p0.AbstractConnectionTester.activeCheckConnection(AbstractConnectionTester.java:79)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:503)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:451)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:443)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishIdleResource(C3P0PooledConnectionPool.java:433)
  • locked <0x0000000704255cd8> (a java.lang.Object)
    at com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:2151)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:648)

Found 1 deadlock.

c3p0-0.9.1.2 APPARENT DEADLOCK!!

I have a question about c3p0 APPARENT DEADLOCK!! WARN message.
How can I reappearance this 「c3p0 APPARENT DEADLOCK」 in develop environment?
In production environment I encountered APPARENT DEADLOCK and my Business Logic server(JbossAs5) hung infinitely.

How can I solve this probelm?
because can not set debugUnreturnedConnectionStackTraces and unreturnedConnectionTimeout
in production environment , I want to reappearance this in local environment first.

①c3p0's setting

Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@b4d742e8 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@62bd41a5 [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> z8kflt99cezf5273d8x0|236ca3d6, idleConnectionTestPeriod -> 300, initialPoolSize -> 30, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 120, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 200, maxStatements -> 150, maxStatementsPerConnection -> 0, minPoolSize -> 30, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@5e8bee0f [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> z8kflt99cezf5273d8x0|3669818a, jdbcUrl -> jdbc:oracle:thin:@192.168.0.210:1521:ORCL, properties -> {user=_, password=_} ], preferredTestQuery -> null, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> z8kflt99cezf5273d8x0|1d0bc9e9, numHelperThreads -> 3 ]

②my bl server log
2015/04/27-18:12:27.406 {WARN }com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@2797b60d -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2015/04/27-18:12:27.412 {WARN }com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@2797b60d -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@3054d932 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@127f7a68 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@6f3d4b54 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
Pending Tasks:
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@211cb0da
com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@629ec931
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@26aae28c
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@1cff6929
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@4451119e
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@265bbf1c
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@515fdaf0
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@6c1eec4c
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@622ba908
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@20667e92
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@28ffb3dc
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@2b79458b
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@26c4bef9
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@3ed5e151
com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@4bbbad11
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@e5f5def
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@170ffd48
com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@1abd8dcc
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@12a859cb
com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@6a9f27fe
com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@76facb61
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4b3e8a4d
com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@76e9ebd2
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@777964fb
com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@42d4d804
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@23b210e3
com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@7f72b963
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@44e953f3
com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@328699dd
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@22df9615
com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@4f64e96
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@46a15c65
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@bb90f1d
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@228f3eee
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6a6c8cfb
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7c9be952
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5ff34667
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5c934567
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@48b19cac
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4a5057d
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6e0b53ec
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@29b2e365
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1f6f1146
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@34d71ac9
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@161f9d39
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@758b1487
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7df0e75a
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@52e5064e
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3a011566
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1d23f94a
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@24c37838
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1d09b763
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@68e6d379
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@a45e2bd
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7228eb8f
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5c8133d6
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@2672560c
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1c6f418c
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4c385ce9
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@85bec17
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4ae8de4a
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7e59f2b1
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,jboss]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1340)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,jboss]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1340)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,jboss]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1340)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)

③jstack's result
all worker thread wait in this way.

"WorkerThread#299[172.24.14.71:37031]" prio=10 tid=0x000000005bd64000 nid=0x7836 in Object.wait() [0x000000006fec4000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1315)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
- locked <0x0000000707860838> (a com.mchange.v2.resourcepool.BasicResourcePool)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:77)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1397)
at sun.reflect.GeneratedMethodAccessor733.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:83)
at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:70)
at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:62)
at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138)
at sun.reflect.GeneratedMethodAccessor732.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:83)
at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:70)
at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:62)
at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76)
at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62)
at sun.reflect.GeneratedMethodAccessor727.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)
at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_684925142.invoke(InvocationContextInterceptor_z_fillMethod_684925142.java)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_684925142.invoke(InvocationContextInterceptor_z_setup_684925142.java)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
at org.jboss.ejb3.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:114)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.remoting.ReplicantsManagerInterceptor.invoke(ReplicantsManagerInterceptor.java:52)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:182)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:363)
at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:967)
at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791)
- locked <0x00000007844a6380> (a org.jboss.remoting.transport.socket.ServerThread)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:586)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)

c3p0 does not recover after MySQLNonTransientConnectionException

We are running ActiveMQ (a JMS) broker with MySQL as backend. For connection pooling we use c3p0 with the following configuration

https://gist.github.com/marco4712/cc68422c50ca1473efd0

When the MySQL DB reboots or in case of a failover, the connection to the database is lost and the broker stops. However, having acquireRetryAttempts and acquireRetryDelay specified with values greater than zero, I would expect c3p0 to pursue corresponding reconnect attempts, but a MySQLNonTransientConnectionException ("No operations allowed after connection closed") is thrown and no reconnect attempts happen.

Please see the full stacktrace below

https://gist.github.com/marco4712/4026ddd138e970724bd1

Is this a bug in c3p0 or subject to wrong configuration?

c3p0 0.9.2.1 - java.lang.AbstractMethodError: com.mchange.v2.c3p0.impl.NewProxyResultSet.isClosed()

I'm using c3p0 0.9.2.1 and whenever I try to call a ResultSet.isClosed() on a non-null, still open result set, I get the following exception:

java.lang.AbstractMethodError: com.mchange.v2.c3p0.impl.NewProxyResultSet.isClosed()

I know it sounds odd, but I have been using c3p0 (always the same version) for quite a while and this exception started to appear only at some point. I couldn't isolate a reason or change for this to happen.
It seems that using 0.9.5-pre5 solves the issue, but as it's production code I would like to keep using a stable version.

Any hints or explanations of this issue?
Thanks

Specifying Config instance

In my other issue (#44) I mentioned my current trivial config.

What I really want to do is provide a TypeSafe Config object to the DataSources class - or some other as-convenient class. I do not want to rely on classpath loading of a configuration file as I have my own Config design. Alternatively, I could be happy with being able to specify a properties/xml/hocon url.

I don't see a clear way to accomplish this right now.
Do you have any suggestions?

AcquireRetryAttempts makes more attempts than is set

With the setting acquireRetryAttempts=1 (in my case I set it in java like this dataSource.setAcquireRetryAttempts(1);)
c3p0 tries to acquire connection twice. Since with acquireRetryAttempts=0 c3p0 will keep trying to fetch a Connection indefinitely, there is no way to set acquireRetryAttempts so that c3p0 will acquire connection only once.

My log:
15:22:44 main INFO (Slf4jMLog.java#log:203): Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 1, acquireRetryAttempts -> 1, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> true, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> oracle.jdbc.OracleDriver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceUseNamedDriverClass -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 1, jdbcUrl -> jdbc:oracle:thin..., maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
...
15:22:44 main TRACE (Slf4jMLog.java#log:187): incremented pending_acquires: 1
15:22:44 main TRACE (Slf4jMLog.java#log:187): Starting acquisition series. Incremented pending_acquires [1], attempts_remaining: 1
...
15:22:44 main TRACE (Slf4jMLog.java#log:187): incremented pending_acquires: 2
15:22:44 main TRACE (Slf4jMLog.java#log:187): Starting acquisition series. Incremented pending_acquires [2], attempts_remaining: 1
...
15:22:44 main TRACE (Slf4jMLog.java#log:187): trace com.mchange.v2.resourcepool.BasicResourcePool@7a53f43e [managed: 0, unused: 0, excluded: 0]
...
15:23:15 C3P0PooledConnectionPoolManager-HelperThread-#2 DEBUG (Slf4jMLog.java#log:198): An exception occurred while acquiring a poolable resource. Will retry.
...
15:23:15 C3P0PooledConnectionPoolManager-HelperThread-#0 DEBUG (Slf4jMLog.java#log:198): An exception occurred while acquiring a poolable resource. Will retry.
...
15:23:16 C3P0PooledConnectionPoolManager-AdminTaskTimer TRACE (Slf4jMLog.java#log:187): Continuing acquisition series. pending_acquires [2], attempts_remaining: 0
...
15:23:16 C3P0PooledConnectionPoolManager-AdminTaskTimer TRACE (Slf4jMLog.java#log:187): Continuing acquisition series. pending_acquires [2], attempts_remaining: 0
...
15:23:46 C3P0PooledConnectionPoolManager-HelperThread-#0 TRACE (Slf4jMLog.java#log:187): decremented pending_acquires: 1
...
15:23:46 C3P0PooledConnectionPoolManager-HelperThread-#0 WARN (Slf4jMLog.java#log:214): com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@5bc2832e -- 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 (1). Last acquisition attempt exception:
...
15:23:46 C3P0PooledConnectionPoolManager-HelperThread-#1 TRACE (Slf4jMLog.java#log:187): decremented pending_acquires: 0
15:23:46 C3P0PooledConnectionPoolManager-HelperThread-#0 ERROR (Slf4jMLog.java#log:219): A RESOURCE POOL IS PERMANENTLY BROKEN! [com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@5bc2832e](because a series of 1 acquisition attempts failed.)
15:23:46 C3P0PooledConnectionPoolManager-HelperThread-#1 WARN (Slf4jMLog.java#log:214): com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1ab9ac3 -- 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 (1). Last acquisition attempt exception:
...
15:23:46 C3P0PooledConnectionPoolManager-HelperThread-#0 TRACE (Slf4jMLog.java#log:187): Acquisition series terminated unsuccessfully. Decremented pending_acquires [0], attempts_remaining: 0

expose connection timeout/error metrics

It would be nice if all sorts of checkout problems (timeout, etc) were tracked in the BasicResourcePool properties.

It looks like attemptRefurbishResourceOnCheckout tracks failed_checkouts which is eventually exposed through PooledDataSource.getNumFailedCheckoutsDefaultUser, but prelimCheckoutResource does not have a similar counter.

We want to track all sorts of db connection problems and potentially alert an on-call engineer should the number of errors elevate. We can do some of this from outside the connection pool, but would like the pool to expose additional details as well.

Here are two stacks from c3p0 0.9.1.2 related to checkout timeouts.

[2014-01-24 10:00:37 -0800] [WARN ] [XXXX] com.mchange.v2.resourcepool.BasicResourcePool - com.mchange.v2.resourcepool.BasicResourcePool@f79b177 -- an attempt to checkout a resource was interrupted, and the pool is still live: some other thread must have either interrupted the Thread attempting checkout!
java.lang.InterruptedException
        at java.lang.Object.wait(Native Method)
        at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1315)
        at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
        at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
        at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@716afedb -- timeout at awaitAvailable()
        at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1317)
        at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
        at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)

can't cast NewProxyConnection to ProxyConnection

I am getting the following error:

java.lang.ClassCastException: com.mchange.v2.c3p0.impl.NewProxyConnection cannot be cast to com.mchange.v2.c3p0.C3P0ProxyConnection 

when attempting to cast the connection received from a ComboPooledDataSource to a ProxyConnection in order to call rawConnectionOperation. I have no troubles when I run this under embedded Jetty and build the data source myself. When I attempt to do this inside of tomcat with the datasource coming from the following resource definition.

<Resource
    name="jdbc/pooledDS"
    auth="Container
    driverClass="org.postgresql.Driver"
    jdbcUrl="jdbc:postgresql://localhost/my-db"
    user="username" password="password"
    initialPoolSize="3"
    minPoolSize="3"
    maxPoolSize="40"
    factory="org.apache.naming.factory.BeanFactory"
    type="com.mchange.v2.c3p0.ComboPooledDataSource" />

then I get the error. Am I doing the configuration wrong in tomcat, or is this unexpected behavior?

Thanks in advance for any help.

how to deregister JDBC driver to prevent a memory leak?

web application inside tomcat, using c3p0 for connection pooling.

driver jconn4-7.07.5.jar located inside .war in directory /WEB-INF/lib/

spring context:

<bean id="dataSource" 
    class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="com.sybase.jdbc4.jdbc.SybDriver"/>
...
</bean>

and during hot redeploy of web application tomcat write to log file:

SEVERE: The web application [/IVRCGate] registered the JDBC driver [com.sybase.jdbc4.jdbc.SybDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

as described in stackoverflow, older tomacat versions can't prevent memory leak.

method deregisterDriver not used in c3p0-0.9.5-pre8 sources at all.

how I can deregister com.sybase.jdbc4.jdbc.SybDriver
driver using c3p0 + spring, during dataSource close?

or this is bug in c3p0 and this bug can be fixed in new versions?

for example, by providing extra property deregisterDriverOnClose
with default value false (for backward compatibility)

NewProxyPreparedStatement.isClosed() issue

While testing I encountered this exception:

java.sql.SQLException: You can't operate on a closed Statement!!!
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77)
    at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.isClosed(NewProxyPreparedStatement.java:2632)
...

The code is doing this:

Statement statement = connection.createStatement();
statement.close();
boolean status = statement.isClosed();

While what is doing is trivial, what is the point of isClosed() if it throws an exception when called on a closed statement. Even though the signature is declared to throw SQLException it should never throw because the statement itself is closed, that rather defeats the purpose.

Allow user to specify a class that indicates whether or not a particular connection exception should be retried

The c3p0 retry logic that tries to work around transient failures by blocking the client connection acquisition until a resource becomes available is a nice feature. However, an unfortunate side effect of this is that certain exceptions indicate states that will never succeed (login failures for example). It would be nice if a user could specify a "tester" class that could return true/false indicating whether or not this exception was eligible for retry. Unfortunately, just the class itself is not enough since many drivers always return the same exception type just with different messages. Something that tests the sqlstate code might work for many drivers, but seems best just to keep it general.

I forked the code and found where this logic happens in BasicPooledResource. I considered pushing a PR that just looked for a vm option indicating the class as a simple solution (which is probably not a good solution since seems like you would want to optionally customize these by pool) -- but decided to see what you think first. My main frustration (not getting good feedback in the logs on failure) has been improved a lot in pre10 (I was on pre2).

InterruptedException is wrapped within an SQLException in C3P0PooledConnection

I saw it's thrown all the way from BasicResourcePool.prelimCheckoutResource to C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse - but in checkoutPooledConnection, it's then masked by a catch-all Exception block.

Working with interrupting threads becomes hard to follow in this case. When it's interrupted while doing a getConnection(), it throws an SQLException caused by an InterruptedException. To handle this, you have to:

catch (SQLException e) {
    Throwable cause = e.getCause();
    if (cause instanceof InterruptedException) { .... }
}

which is a bit of a stretch, and not really politically correct.

Wouldn't it be nicer to just let us handle an InterruptedException directly?

Implement toString() on c3p0 statement proxy statement implementations

Some statement implementations (postgres) for e.g. will generate a nice string representation of the statement. When using c3p0 for connection pooling, it is missing the toString implementation which causes it to not generate a nice readable statement.

I looked around the code but could not pinpoint where I can generate the relevant toString implementation for the various proxy statements, if you can point me – I'm happy to provide a pull request.

A lot of FileNotFoundException stacktraces in c3p0 log

I configure c3p0 through java so I don't have any .properties files for c3p0. Therefore I have a lot of FileNotFoundException stacktraces in c3p0 log (several time for each .properties file) They all on debug level but still do we need all that stacktraces in the lines which tell us about absence of that files?

With all that stacktraces log looks not very pretty:

15:22:43 MLog-Init-Reporter DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier '/mchange-commons.properties' could not be found. Skipping.
java.io.FileNotFoundException: Resource not found at path '/mchange-commons.properties'.
at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.ConfigUtils.readVmConfig(ConfigUtils.java:115)
at com.mchange.v2.cfg.MLogConfigSource.readVmConfig(MLogConfigSource.java:46)
at com.mchange.v2.log.MLogConfig.refresh(MLogConfig.java:59)
at com.mchange.v2.log.MLog.refreshConfig(MLog.java:59)
at com.mchange.v2.log.MLog.(MLog.java:51)
at com.mchange.v2.naming.JavaBeanReferenceMaker.(JavaBeanReferenceMaker.java:51)
at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.(PoolBackedDataSourceBase.java:263)
...
15:22:43 MLog-Init-Reporter DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier '/c3p0.properties' could not be found. Skipping.
java.io.FileNotFoundException: Resource not found at path '/c3p0.properties'.
at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.ConfigUtils.readVmConfig(ConfigUtils.java:115)
at com.mchange.v2.cfg.MLogConfigSource.readVmConfig(MLogConfigSource.java:46)
at com.mchange.v2.log.MLogConfig.refresh(MLogConfig.java:59)
at com.mchange.v2.log.MLog.refreshConfig(MLog.java:59)
at com.mchange.v2.log.MLog.(MLog.java:51)
at com.mchange.v2.naming.JavaBeanReferenceMaker.(JavaBeanReferenceMaker.java:51)
at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.(PoolBackedDataSourceBase.java:263)
...
15:22:43 main DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier '/mchange-commons.properties' could not be found. Skipping.
java.io.FileNotFoundException: Resource not found at path '/mchange-commons.properties'.
at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.MConfig$CSManager.recreateFromKey(MConfig.java:153)
at com.mchange.v1.cachedstore.NoCleanupCachedStore.find(NoCleanupCachedStore.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.mchange.v1.lang.Synchronizer$1.invoke(Synchronizer.java:58)
at com.sun.proxy.$Proxy4.find(Unknown Source)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:75)
at com.mchange.v2.c3p0.cfg.C3P0Config.findLibraryMultiPropertiesConfig(C3P0Config.java:157)
at com.mchange.v2.c3p0.cfg.C3P0Config.(C3P0Config.java:143)
at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.(PoolBackedDataSourceBase.java:54)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.(AbstractPoolBackedDataSource.java:74)
at com.mchange.v2.c3p0.AbstractComboPooledDataSource.(AbstractComboPooledDataSource.java:142)
at com.mchange.v2.c3p0.AbstractComboPooledDataSource.(AbstractComboPooledDataSource.java:138)
at com.mchange.v2.c3p0.ComboPooledDataSource.(ComboPooledDataSource.java:47)
...
15:22:43 MLog-Init-Reporter DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier 'hocon:/reference,/application,/c3p0,/' could not be found. Skipping.
java.io.FileNotFoundException: HOCON lib (typesafe-config) is not available. Also, no resource available at '/reference,/application,/c3p0,/' for HOCON identifier 'hocon:/reference,/application,/c3p0,/'.
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.configSource(BasicMultiPropertiesConfig.java:86)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:184)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.ConfigUtils.readVmConfig(ConfigUtils.java:115)
at com.mchange.v2.cfg.MLogConfigSource.readVmConfig(MLogConfigSource.java:46)
at com.mchange.v2.log.MLogConfig.refresh(MLogConfig.java:59)
at com.mchange.v2.log.MLog.refreshConfig(MLog.java:59)
at com.mchange.v2.log.MLog.(MLog.java:51)
at com.mchange.v2.naming.JavaBeanReferenceMaker.(JavaBeanReferenceMaker.java:51)
at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.(PoolBackedDataSourceBase.java:263)
...
15:22:43 MLog-Init-Reporter DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier '/mchange-log.properties' could not be found. Skipping.
java.io.FileNotFoundException: Resource not found at path '/mchange-log.properties'.
at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.ConfigUtils.readVmConfig(ConfigUtils.java:115)
at com.mchange.v2.cfg.MLogConfigSource.readVmConfig(MLogConfigSource.java:46)
at com.mchange.v2.log.MLogConfig.refresh(MLogConfig.java:59)
at com.mchange.v2.log.MLog.refreshConfig(MLog.java:59)
at com.mchange.v2.log.MLog.(MLog.java:51)
at com.mchange.v2.naming.JavaBeanReferenceMaker.(JavaBeanReferenceMaker.java:51)
at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.(PoolBackedDataSourceBase.java:263)
...
15:22:43 main DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier '/mchange-log.properties' could not be found. Skipping.
java.io.FileNotFoundException: Resource not found at path '/mchange-log.properties'.
at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.MConfig$CSManager.recreateFromKey(MConfig.java:153)
at com.mchange.v1.cachedstore.NoCleanupCachedStore.find(NoCleanupCachedStore.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.mchange.v1.lang.Synchronizer$1.invoke(Synchronizer.java:58)
at com.sun.proxy.$Proxy4.find(Unknown Source)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:75)
at com.mchange.v2.c3p0.cfg.C3P0Config.findLibraryMultiPropertiesConfig(C3P0Config.java:157)
at com.mchange.v2.c3p0.cfg.C3P0Config.(C3P0Config.java:143)
at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.(PoolBackedDataSourceBase.java:54)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.(AbstractPoolBackedDataSource.java:74)
at com.mchange.v2.c3p0.AbstractComboPooledDataSource.(AbstractComboPooledDataSource.java:142)
at com.mchange.v2.c3p0.AbstractComboPooledDataSource.(AbstractComboPooledDataSource.java:138)
at com.mchange.v2.c3p0.ComboPooledDataSource.(ComboPooledDataSource.java:47)
...
15:22:43 main DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier 'hocon:/reference,/application,/c3p0,/' could not be found. Skipping.
java.io.FileNotFoundException: HOCON lib (typesafe-config) is not available. Also, no resource available at '/reference,/application,/c3p0,/' for HOCON identifier 'hocon:/reference,/application,/c3p0,/'.
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.configSource(BasicMultiPropertiesConfig.java:86)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:184)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.MConfig$CSManager.recreateFromKey(MConfig.java:153)
at com.mchange.v1.cachedstore.NoCleanupCachedStore.find(NoCleanupCachedStore.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.mchange.v1.lang.Synchronizer$1.invoke(Synchronizer.java:58)
at com.sun.proxy.$Proxy4.find(Unknown Source)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:75)
at com.mchange.v2.c3p0.cfg.C3P0Config.findLibraryMultiPropertiesConfig(C3P0Config.java:157)
at com.mchange.v2.c3p0.cfg.C3P0Config.(C3P0Config.java:143)
at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.(PoolBackedDataSourceBase.java:54)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.(AbstractPoolBackedDataSource.java:74)
at com.mchange.v2.c3p0.AbstractComboPooledDataSource.(AbstractComboPooledDataSource.java:142)
at com.mchange.v2.c3p0.AbstractComboPooledDataSource.(AbstractComboPooledDataSource.java:138)
at com.mchange.v2.c3p0.ComboPooledDataSource.(ComboPooledDataSource.java:47)
...
15:22:44 main DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier '/c3p0.properties' could not be found. Skipping.
java.io.FileNotFoundException: Resource not found at path '/c3p0.properties'.
at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.MConfig$CSManager.recreateFromKey(MConfig.java:153)
at com.mchange.v1.cachedstore.NoCleanupCachedStore.find(NoCleanupCachedStore.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.mchange.v1.lang.Synchronizer$1.invoke(Synchronizer.java:58)
at com.sun.proxy.$Proxy4.find(Unknown Source)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:75)
at com.mchange.v2.c3p0.cfg.C3P0Config.findLibraryMultiPropertiesConfig(C3P0Config.java:157)
at com.mchange.v2.c3p0.cfg.C3P0Config.(C3P0Config.java:143)
at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.(PoolBackedDataSourceBase.java:54)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.(AbstractPoolBackedDataSource.java:74)
at com.mchange.v2.c3p0.AbstractComboPooledDataSource.(AbstractComboPooledDataSource.java:142)
at com.mchange.v2.c3p0.AbstractComboPooledDataSource.(AbstractComboPooledDataSource.java:138)
at com.mchange.v2.c3p0.ComboPooledDataSource.(ComboPooledDataSource.java:47)
...
15:22:44 main DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier '/mchange-commons.properties' could not be found. Skipping.
java.io.FileNotFoundException: Resource not found at path '/mchange-commons.properties'.
at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.MConfig$CSManager.recreateFromKey(MConfig.java:153)
at com.mchange.v1.cachedstore.NoCleanupCachedStore.find(NoCleanupCachedStore.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.mchange.v1.lang.Synchronizer$1.invoke(Synchronizer.java:58)
at com.sun.proxy.$Proxy4.find(Unknown Source)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:75)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:81)
at com.mchange.v2.resourcepool.BasicResourcePool.(BasicResourcePool.java:60)
at com.mchange.v2.resourcepool.BasicResourcePoolFactory.createPool(BasicResourcePoolFactory.java:340)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.(C3P0PooledConnectionPool.java:671)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createPooledConnectionPool(C3P0PooledConnectionPoolManager.java:952)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:397)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:414)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
...
15:22:44 main DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier '/mchange-log.properties' could not be found. Skipping.
java.io.FileNotFoundException: Resource not found at path '/mchange-log.properties'.
at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.MConfig$CSManager.recreateFromKey(MConfig.java:153)
at com.mchange.v1.cachedstore.NoCleanupCachedStore.find(NoCleanupCachedStore.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.mchange.v1.lang.Synchronizer$1.invoke(Synchronizer.java:58)
at com.sun.proxy.$Proxy4.find(Unknown Source)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:75)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:81)
at com.mchange.v2.resourcepool.BasicResourcePool.(BasicResourcePool.java:60)
at com.mchange.v2.resourcepool.BasicResourcePoolFactory.createPool(BasicResourcePoolFactory.java:340)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.(C3P0PooledConnectionPool.java:671)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createPooledConnectionPool(C3P0PooledConnectionPoolManager.java:952)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:397)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:414)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
...
15:22:44 main DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier '/c3p0.properties' could not be found. Skipping.
java.io.FileNotFoundException: Resource not found at path '/c3p0.properties'.
at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.MConfig$CSManager.recreateFromKey(MConfig.java:153)
at com.mchange.v1.cachedstore.NoCleanupCachedStore.find(NoCleanupCachedStore.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.mchange.v1.lang.Synchronizer$1.invoke(Synchronizer.java:58)
at com.sun.proxy.$Proxy4.find(Unknown Source)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:75)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:81)
at com.mchange.v2.resourcepool.BasicResourcePool.(BasicResourcePool.java:60)
at com.mchange.v2.resourcepool.BasicResourcePoolFactory.createPool(BasicResourcePoolFactory.java:340)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.(C3P0PooledConnectionPool.java:671)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createPooledConnectionPool(C3P0PooledConnectionPoolManager.java:952)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:397)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:414)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
...
15:22:44 main DEBUG (Slf4jMLog.java#log:198): The configuration file for resource identifier 'hocon:/reference,/application,/c3p0,/' could not be found. Skipping.
java.io.FileNotFoundException: HOCON lib (typesafe-config) is not available. Also, no resource available at '/reference,/application,/c3p0,/' for HOCON identifier 'hocon:/reference,/application,/c3p0,/'.
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.configSource(BasicMultiPropertiesConfig.java:86)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:184)
at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63)
at com.mchange.v2.cfg.MConfig$CSManager.recreateFromKey(MConfig.java:153)
at com.mchange.v1.cachedstore.NoCleanupCachedStore.find(NoCleanupCachedStore.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.mchange.v1.lang.Synchronizer$1.invoke(Synchronizer.java:58)
at com.sun.proxy.$Proxy4.find(Unknown Source)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:75)
at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:81)
at com.mchange.v2.resourcepool.BasicResourcePool.(BasicResourcePool.java:60)
at com.mchange.v2.resourcepool.BasicResourcePoolFactory.createPool(BasicResourcePoolFactory.java:340)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.(C3P0PooledConnectionPool.java:671)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createPooledConnectionPool(C3P0PooledConnectionPoolManager.java:952)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:397)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:414)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)

Fully predictable MBean names for pools

I'd ilke to use jboss2nagios to monitor the active connections etc on a production system. However the c3p0 MBeans still use their dynamically generated unique id as part of the MBean name. The Nagios plugin cannot deal with this as it only uses object name lookups, rather than queries. Since I know exactly which pools will be in the JBoss JVM, it would be useful to have the option to omit the id and specify the exact MBean names.

Provide ability to execute a "init sql string" on acquiring a database connection.

While ConnectionCustomizers do provide a way to execute some init sqls on acquiring a new database connection, it doesn't easily support something like a "ALTER SESSION SET CURRENT SCHEMA = ".

It would be great if, similar to a "preferredTestQuery" SQL, C3P0 also accepts an "initSQL" that is executed once per new connection before being placed in the pool. This is supported by DBCP and tomcat-jdbc connection pools currently and would be a very useful addition to C3P0.

ResourcePool [BROKEN!]: Tried to check-in a foreign resource!

While running the HikariCP benchmarks on Statement cycles, I often encounter this exception on several iterations during the run:

Iteration  20: [com.zaxxer.hikari.benchmark.StatementBench.cycleStatement-worker5] ERROR com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool - An Exception occurred while trying to check a PooledConection into a ResourcePool.
[com.zaxxer.hikari.benchmark.StatementBench.cycleStatement-worker7] ERROR com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool - An Exception occurred while trying to check a PooledConection into a ResourcePool.
[com.zaxxer.hikari.benchmark.StatementBench.cycleStatement-worker6] ERROR com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool - An Exception occurred while trying to check a PooledConection into a ResourcePool.
[com.zaxxer.hikari.benchmark.StatementBench.cycleStatement-worker3] ERROR com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool - An Exception occurred while trying to check a PooledConection into a ResourcePool.
java.sql.SQLException: An SQLException was provoked by the following failure: com.mchange.v2.resourcepool.ResourcePoolException: ResourcePool [BROKEN!]: Tried to check-in a foreign resource!
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77)
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:74)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkinPooledConnection(C3P0PooledConnectionPool.java:810)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$ConnectionEventListenerImpl.doCheckinResource(C3P0PooledConnectionPool.java:909)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$ConnectionEventListenerImpl.connectionClosed(C3P0PooledConnectionPool.java:901)
    at com.mchange.v2.c3p0.util.ConnectionEventSupport.fireConnectionClosed(ConnectionEventSupport.java:73)
    at com.mchange.v2.c3p0.impl.NewPooledConnection.fireConnectionClosed(NewPooledConnection.java:583)
    at com.mchange.v2.c3p0.impl.NewPooledConnection.markClosedProxyConnection(NewPooledConnection.java:452)
    at com.mchange.v2.c3p0.impl.NewProxyConnection.close(NewProxyConnection.java:87)
    at com.zaxxer.hikari.benchmark.StatementBench$ConnectionState.teardown(StatementBench.java:63)
    at com.zaxxer.hikari.benchmark.generated.StatementBench.cycleStatement_Throughput(StatementBench.java:86)
    at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.openjdk.jmh.runner.LoopMicroBenchmarkHandler$BenchmarkTask.invokeBenchmark(LoopMicroBenchmarkHandler.java:231)
    at org.openjdk.jmh.runner.LoopMicroBenchmarkHandler$BenchmarkTask.call(LoopMicroBenchmarkHandler.java:199)
    at org.openjdk.jmh.runner.LoopMicroBenchmarkHandler$BenchmarkTask.call(LoopMicroBenchmarkHandler.java:184)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: com.mchange.v2.resourcepool.ResourcePoolException: ResourcePool [BROKEN!]: Tried to check-in a foreign resource!
    at com.mchange.v2.resourcepool.BasicResourcePool.checkinResource(BasicResourcePool.java:706)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.unmarkConnectionInUseAndCheckin(C3P0PooledConnectionPool.java:798)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkinPooledConnection(C3P0PooledConnectionPool.java:807)
    ... 18 more

I do not encounter errors with other pools tested (tomcat, BoneCP, vibur, HikariCP).

You can checkout and run the benchmark from here.

If you want to isolate the benchmark to C3P0 and the Statement cycle benchmark specifically, run:

./benchmark.sh medium -p pool=c3p0 ".*Statement.*"

(assuming Linux or MacOS X, sorry no Windows batch file but you can make one using the benchmark.sh as a base).

Just for reference, the benchmark source looks like:

@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
public class StatementBench extends BenchBase {
    @GenerateMicroBenchmark
    public Statement cycleStatement(ConnectionState state) throws SQLException {
        Statement statement = state.connection.createStatement();
        state.consume(statement.execute("INSERT INTO test (column) VALUES (?)"));
        statement.close();
        return statement;
    }

    @State(Scope.Thread)
    public static class ConnectionState extends BlackHole {
        Connection connection;

        @Setup(Level.Iteration)
        public void setup() throws SQLException {
            connection = DS.getConnection();
        }

        @TearDown(Level.Iteration)
        public void teardown() throws SQLException {
            connection.close();
        }
    }
}

The JMH benchmark harness invokes the ConnectionState.setup() method, from each of the 8 benchmark threads, before each iteration . During each iteration JMH calls cycleStatement() as many times as possible, again multi-threaded, in a one second window. After each iteration, JMH invokes the ConnectionState.teardown() method from each thread. Basically, each thread has it's own scoped ConnectionState object created by the JMH harness, so there is no cross-thread access to a Connection.

The exception seems to be thrown from the teardown, it only happens perhaps every 30 iterations or so, but it smells like a race condition to me.

You may need a multi-core CPU to reproduce the issue, as it seems timing sensitive. I'm running a Core i7 with 4-cores and hyper-threading.

Just thought you'd want to know.

C3P0Registry.extensionsForToken in ConnectionCustomizer leads to deadlock in unit tests

We are running Persistence UnitTests on build server for every commit.
Recently we added ConnectionCustomizer to our application. Now some times the unit tests are getting to deadlock. (The jstack attached http://pyx4j.com/bug/c3p0-54/jstack-deadlock.log)

This is not related to particular test. When I try to reproduce this on local computer I need approximately 1000 build runs with test to get to deadlock.

We have 500 tests with the same connection flow. Probability of deadlock 1/500,000

Please advise how we should continue. I can create a standalone unit test or code fragment to reproduce the problem. if required.

Here is my flow.
Tests are not running in parallel. Each test is closing connection Pool.
OS: Windows or Linux; Latest Java 8, Latest C3P0 0.9.5

There is a ConnectionCustomizer that need information about our ConnectionPoolType.

So we used:

        ComboPooledDataSource dataSource = new ComboPooledDataSource(false);

        Map<String, Object> extensions = new HashMap<>();
        extensions.put(MyConnectionPoolType.class.getName(), myConnectionType);
        dataSource.setExtensions(extensions);

       dataSource.setConnectionCustomizerClassName(MyC3P0ConnectionCustomizer.class.getName());

And code fragment form ConnectionCustomizer:

MyC3P0ConnectionCustomizer  extends AbstractConnectionCustomizer  {

    public void onAcquire(Connection c, String dataSourceIdentityToken) throws Exception {

        Map<String, Object> tokenExtensions = extensionsForToken(dataSourceIdentityToken); // <-  deadlock inside this call.
        // other code here
     }
}

Cannot survive from isValid(...) hang because IS_VALID_TIMEOUT in DefaultConnectionTester is hard coded to 0

Sometimes, maybe due to issues in Microsoft JDBC driver and/or Microsoft Azure service, isValid(..) method just hangs (or cannot return within several minutes). In that case, dropping the connection and creating another one seems to be better than waiting infinitely.

I noticed that it is hard coded in DefaultConnectionTester.java that
final static int IS_VALID_TIMEOUT = 0;

So the suggestion is the make this value configuration so that if needed, we can override it with values like 30 seconds or something.

Below is the dump of the hanging thread:

java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.readInternal(IOBuffer.java:895)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.read(IOBuffer.java:883)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
- locked <0x000000054692fcf8> (a java.lang.Object)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:911)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
- locked <0x0000000546941688> (a sun.security.ssl.AppInputStream)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1782)
at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:4838)
- locked <0x00000006ac836c98> (a com.microsoft.sqlserver.jdbc.TDSReader)
at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:6150)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:797)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:696)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1716)
- locked <0x0000000546941bf0> (a java.lang.Object)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeQueryInternal(SQLServerStatement.java:631)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.isValid(SQLServerConnection.java:3369)
at com.mchange.v2.c3p0.impl.DefaultConnectionTester$2.activeCheckConnectionNoQuery(DefaultConnectionTester.java:128)
at com.mchange.v2.c3p0.impl.DefaultConnectionTester$3.activeCheckConnectionNoQuery(DefaultConnectionTester.java:172)
at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:251)
at com.mchange.v2.c3p0.AbstractConnectionTester.activeCheckConnection(AbstractConnectionTester.java:79)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:503)

Failed to set property: extensions

Hello,
i use Version 0.9.2.1, now i updated to 0.9.5-pre5 to test it.
this exception come up:

2013-10-23 09:55:46,098 WARN [main] com.mchange.v2.beans.BeansUtils (BeansUtils.java:303) - Failed to set property: extensions [propVal: {}; propType: interface java.util.Map]
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.mchange.v2.beans.BeansUtils.overwriteAccessiblePropertiesFromMap(BeansUtils.java:295)
at com.mchange.v2.c3p0.DataSources.pooledDataSource(DataSources.java:283)
at com.mchange.v2.c3p0.DataSources.pooledDataSource(DataSources.java:262)
at de.dat.sphinx.global.db.DBConfigManager.getDataSource(DBConfigManager.java:118)

CodeSnippet:

de.dat.sphinx.global.db.DBConfigManager.getDataSource(DBConfigManager.java:118)
-->
String jdbcUrl = ps[1];
final String user = username != null ? username : ps[2];
String pass = password != null ? password : ps[3];
final DataSource ds_unpooled = DataSources.unpooledDataSource( jdbcUrl, user, pass );
ds = DataSources.pooledDataSource( ds_unpooled, props );

What am i doing wrong?

Sam

Add optimized retrieval of cached PreparedStatements

Right now it's not possible to guarantee that a connection obtained from the connection pool would have a PreparedStatement that it's going to create in the cache. In fact, it's possible to get a connection without a PreparedStatement in the cache while other connection that has it would sit the pool. This stems from the fact that the pool doesn't know what statement the consumer is going to prepare. The solution is to delay the DB operations by returning a wrapper that logs other operations until the prepareStatement() is called, or any other operation that requires actual DB access is called and only then retrieve the connection from the pool.

In other words, delay retrieving the connection from the pool until the Connection.prepareStatement() is called. At that time a connection pool would look up available connections by the SQL statement text and then play forward all the calls made between createConnection() and until and including Connection.prepareStatement(). This way it would be possible to get a connection with a ready / cached PreparedStatement.

Hope this helps.

Regards,

Slava Imeshev

Discard pools which fail to initialise to avoid continual attempts to create

When a pool is configured with invalid credentials (username and/or password) an exception is thrown when the pool attempts to initialise. The issue is that 300 seconds later (and then every 75 seconds) the pool tries to reconnect using those invalid credentials thus filling logs files with junk and causing potentially a large number of spurious database connection requests.

This is caused by the cull task trying to ensure that the pool has the correct minimum number of connections. When the credentials are invalid the pool size is zero so each time the cull task runs it tries to bring the pool up to the correct size (i.e. the max of initPoolSize and minPoolSize)

To workaround this the pool must be marked as broken by setting the breakAfterAcquireFailure property to true. That has the effect of killing the pool though.

The functionality I'd like is for the instance of BasicResourcePool to be discarded when initialization fails. Thus only when the next user request comes in would an attempt be made to create it again. Should the credentials have been fixed (most likely by the DB account being unlocked, or created, or having the password set correctly) this would result in a valid pool being created, otherwise just one set of connection errors would occur in response to that single user initiated request.

I'm happy to submit a pull request for this if I can get some assistance in setting up a working development environment for the project. I've tried a couple of times and had problems with missing autogenerated classes (e.g. PoolBackedDataSourceBase).

c3p0 produces java.sql.SQLWarning: 010CP: AutoCommit option has changed to true. All pending statements on this transaction (if any) are committed.

In com.mchange.v2.c3p0.impl.C3P0ImplUtils.resetTxnState() called pCon.setAutoCommit( true );

This produces SQLWarnings from jconn4.jar driver, and no way to switch off this sticky befavior of c3p0.

I need to disable default cnained mode and autocommit mode for Sybase database, because I use
org.springframework.data.transaction.ChainedTransactionManager which chains two transactions: JMS and JDBC one, it need for: "Best Efforts 1PC pattern", http://www.javaworld.com/article/2077963/

If I use default settings for Sybase, chained mode and autocommit - it this case Spring Framework start nested JDBC transactions and application stop working after database locks escalated from lock datarow to locking entire table.

If I create own ConnectionCustomizer which do connection.setAutoCommit(false);
inside onAcquire() and onCheckOut() methods - log quickly filled up with SQLWarnings,
produced by c3p0 code.

Probably this is bug in c3p0 and users should have ability to permamently disable autocommit mode,
without SQLWarnings in log, just by cnanging c3p0 config.

P.S. http://stackoverflow.com/questions/17465133/setautocommitfalse-not-working-with-c3p0

P.P.S.

2014-09-14 18:14:16.137 | INFO  | -HelperThread-#0 | com.mchange.v2.c3p0.SQLWarnings            | 010CP: AutoCommit option has changed to true. All pending statements on this transaction (if any) are committed.
java.sql.SQLWarning: 010CP: AutoCommit option has changed to true. All pending statements on this transaction (if any) are committed.
    at com.sybase.jdbc4.jdbc.ErrorMessage.createWarning(ErrorMessage.java:892) ~[jconn4-7.07.5.jar:JDK 1.6/jdbcmain/Mon Oct 15 11:38:15 PDT 2012]
    at com.sybase.jdbc4.jdbc.ErrorMessage.raiseWarning(ErrorMessage.java:858) ~[jconn4-7.07.5.jar:JDK 1.6/jdbcmain/Mon Oct 15 11:38:15 PDT 2012]
    at com.sybase.jdbc4.tds.Tds.setOption(Tds.java:1769) ~[jconn4-7.07.5.jar:JDK 1.6/jdbcmain/Mon Oct 15 11:38:15 PDT 2012]
    at com.sybase.jdbc4.jdbc.SybConnection.setAutoCommit(SybConnection.java:1500) ~[jconn4-7.07.5.jar:JDK 1.6/jdbcmain/Mon Oct 15 11:38:15 PDT 2012]
    at com.mchange.v2.c3p0.impl.C3P0ImplUtils.resetTxnState(C3P0ImplUtils.java:247) ~[c3p0-0.9.2.1.jar:0.9.2.1]
    at com.mchange.v2.c3p0.impl.NewPooledConnection.reset(NewPooledConnection.java:448) ~[c3p0-0.9.2.1.jar:0.9.2.1]
    at com.mchange.v2.c3p0.impl.NewPooledConnection.markClosedProxyConnection(NewPooledConnection.java:404) ~[c3p0-0.9.2.1.jar:0.9.2.1]
    at com.mchange.v2.c3p0.impl.NewProxyConnection.close(NewProxyConnection.java:1225) ~[c3p0-0.9.2.1.jar:0.9.2.1]
    at org.springframework.jdbc.datasource.DataSourceUtils.doCloseConnection(DataSourceUtils.java:341) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:328) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.jdbc.datasource.DataSourceUtils.releaseConnection(DataSourceUtils.java:294) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCleanupAfterCompletion(DataSourceTransactionManager.java:326) ~[spring-jdbc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:1012) ~[spring-tx-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:807) ~[spring-tx-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726) ~[spring-tx-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.data.transaction.MultiTransactionStatus.commit(MultiTransactionStatus.java:73) ~[spring-data-commons-1.9.0.RELEASE.jar:na]
    at org.springframework.data.transaction.ChainedTransactionManager.commit(ChainedTransactionManager.java:145) ~[spring-data-commons-1.9.0.RELEASE.jar:na]
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:240) ~[spring-jms-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1137) ~[spring-jms-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1129) ~[spring-jms-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1031) ~[spring-jms-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at java.lang.Thread.run(Thread.java:745) ~[na:1.7.0_65]

PreparedStatement.getMetaData() without PreparedStatement.executeQuery() sometimes fails

Test to reproduce the error:
https://gist.github.com/georgewfraser/4de73d8f03c864665235

JDBC allows you to call PreparedStatement.getMetaData() on a query without calling PreparedStatement.executeQuery. This is handy when you want to find out what a query is going to produce now, but wait to execute it later.

Suppose C3P0 is doing statement pooling and we execute the following requests:

statement = connection.prepareStatement("SELECT 1 AS value");
result = statement.executeQuery();
result.close();

statement = connection.prepareStatement("SELECT 1 AS value");
metaData = statement.getMetaData();

The last line will fail. With connection pooling off, it succeeds. The reason is:

  1. The first prepareStatement(...) creates a new raw PreparedStatement object and puts it in the pool.
  2. The second prepareStatement(...) fetches the same PreparedStatement from the pool.
  3. statement.getMetaData() delegates to inner.getMetaData()
  4. inner.getMetaData() checks whether the current ResultSet is null.
  5. If the current ResultSet is null, it executes a special query with no results in order to retrieve the metadata. This is what we want, but unfortunately there is already a ResultSet from step 1.
  6. Because there is already a ResultSet, inner calls ResultSet.getMetaData().
  7. This ResultSet has already been closed, so it fails.

I propose the following fix:

  1. NewProxyPreparedStatment.getMetaData() should check if inner.isClosed() before calling inner.getMetaData().
  2. If inner is already closed, create a new PreparedStatement and call getMetaData() on it.

•$Proxy78 cannot be cast to oracle.sql.CLOB

I'm trying to use the C3P0 connection pool (com.mchange.v2.c3p0.ComboPooledDataSource c3p0-0.9.1.2.jar), but I'm receiving this error when trying to load an object holding a Clob (Oracle database):
•$Proxy78 cannot be cast to oracle.sql.CLOB

full stack trace is as below

Caused by: java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.ClassCastException: com.sun.proxy.$Proxy78 cannot be cast to oracle.sql.CLOB at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65) at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:62) at com.mchange.v2.c3p0.impl.NewPooledConnection.handleThrowable(NewPooledConnection.java:432) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setClob(NewProxyPreparedStatement.java:535) at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$2$1.doBind(ClobTypeDescriptor.java:70) at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1$1.doBind(ClobTypeDescriptor.java:56) at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:91) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:283) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:278) at org.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:340) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2184) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2559) ... 71 more Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy78 cannot be cast to oracle.sql.CLOB at oracle.jdbc.driver.OraclePreparedStatement.setClob(OraclePreparedStatement.java:6559) at oracle.jdbc.driver.OraclePreparedStatementWrapper.setClob(OraclePreparedStatementWrapper.java:158) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setClob(NewProxyPreparedStatement.java:521) ... 79 more

No resource available at '/reference.conf'

Version Used

    <dependency>
        <groupId>com.mchange</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.5-pre2</version>
        <scope>test</scope>
    </dependency>

Given this configuration in Spring 3

<bean id="vrsDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
    <property name="driverClass" value="com.mysql.jdbc.Driver"/>
    <property name="jdbcUrl" value="jdbc:mysql://192.168.170.138:3306/mmc_vrsdb"/>
    <property name="user" value="vrsmmc_root"/>
    <property name="password" value="vrsmmc_root"/>
    <property name="preferredTestQuery" value="SELECT 1"/>
    <property name="idleConnectionTestPeriod" value="14400"/>
    <property name="testConnectionOnCheckin" value="true"/>
    <property name="testConnectionOnCheckout" value="false"/>
    <property name="minPoolSize" value="1"/>
    <property name="maxPoolSize" value="5"/>
    <property name="acquireIncrement" value="1"/>
    <property name="maxIdleTimeExcessConnections" value="240"/>
</bean>

The following error was thrown

2013-05-17 09:26:44,618 [MLog-Init-Reporter] [ INFO] MLog:106 - MLog clients using log4j logging.
2013-05-17 09:26:44,633 [MLog-Init-Reporter] [DEBUG] MLog:95 - Could not find resource path text file for path '/com/mchange/v2/cfg/vmConfigResourcePaths.txt'
2013-05-17 09:26:44,633 [MLog-Init-Reporter] [DEBUG] MLog:95 - Added paths from resource path text file at '/mchange-config-resource-paths.txt'
2013-05-17 09:26:44,633 [MLog-Init-Reporter] [DEBUG] MLog:95 - Reading VM config for path list /com/mchange/v2/log/default-mchange-log.properties, hocon:/reference.conf, /mchange-commons.properties, hocon:/application.conf, /c3p0.properties, hocon:/c3p0.conf, /mchange-log.properties, /
2013-05-17 09:26:44,633 [MLog-Init-Reporter] [DEBUG] MLog:95 - The configuration file for resource identifier 'hocon:/reference.conf' could not be found. Skipping.
java.io.FileNotFoundException: No resource available at '/reference.conf' for HOCON identifier 'hocon:/reference.conf'. Also HOCON lib (typesafe-config) is not available.
    at com.mchange.v2.cfg.BasicMultiPropertiesConfig.configSource(BasicMultiPropertiesConfig.java:86)
    at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:174)
    at com.mchange.v2.cfg.BasicMultiPropertiesConfig.(BasicMultiPropertiesConfig.java:110)
    at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:57)
    at com.mchange.v2.cfg.ConfigUtils.readVmConfig(ConfigUtils.java:106)
    at com.mchange.v2.cfg.MLogConfigSource.readVmConfig(MLogConfigSource.java:46)
    at com.mchange.v2.log.MLogConfig.(MLogConfig.java:58)
    at com.mchange.v2.log.MLog.(MLog.java:50)

Action Taken

Revert to version 0.9.2.1

hibernate 4.2.0CR2 + c3p0 0.9.5-pre + jtds 1.3.0 @Lob issue

I guess this is related to c3p0 doesn't support jdbc 4 yet.
I've saw your last commit with "Full jdbc4 support" on 0.9.5 version, so I gave it a try...
I am getting the following error messages. Tried 0.9.2 as well, the same error.
Thanks!

Mar 05, 2013 9:04:19 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [default] in context with path [/clara-webapp] threw exception [Handler processing failed; nested exception is java.lang.AbstractMethodError] with root cause
java.lang.AbstractMethodError
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setCharacterStream(JtdsPreparedStatement.java:1274)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setCharacterStream(NewProxyPreparedStatement.java:1007)
at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$4$1.doBind(ClobTypeDescriptor.java:114)
at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:92)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:280)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:275)
at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:57)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2777)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2752)
at org.hibernate.persister.entity.AbstractEntityPersister$4.bindValues(AbstractEntityPersister.java:2959)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2966)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3477)
at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:81)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:203)
at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:183)
at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:167)
at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:321)

Unfinit try to getConnection() from DataSources.pooledDataSrouce even the SQLException is thrown

I use DataSourcer.pooledDataSource to create pooled datasource from unpooled version. Problem is, when the unpooled datasource throw exception, when getConnection() is called. The Pooled wraper consume the exception and try to connect onesmore by call getConnection(). So the recursion is unfinit, until the application fall down on heap dump.

For reproduction create simple implementation of DataSource with:
getConnection() { throw SQLException(); }

DataSource ds = DataSources.pooledDataSource(new YourDataSource());
ds.getConnection();

Failed to get requested attribute: numIdleConnections

Hi,
We have recently moved our app from Jetty6 to Jetty8, and we are not seeing any attribute values for some of the NetBeans in JMX. However we are now seeing errors like the below in the Jetty log. Has anyone else moved from Jetty6(OpenJDK-6) to Jetty8(OpenJDK-7) and experienced anything similar?

WARN [com.mchange.v2.c3p0.management.DynamicPooledDataSourceManagerMBean] - Failed to get requested attribute: numBusyConnections
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.mchange.v2.c3p0.management.DynamicPooledDataSourceManagerMBean.getAttribute(DynamicPooledDataSourceManagerMBean.java:366)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)

NPE at NewProxyConnection.java:1073

Caused by: java.sql.SQLException: You can't operate on a closed Connection!!!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118) ~[mchange-commons-java-0.2.7.jar:0.2.7]
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77) ~[mchange-commons-java-0.2.7.jar:0.2.7]
at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:1109) ~[c3p0-0.9.5-pre8.jar:0.9.5-pre8]
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:162) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
... 40 common frames omitted
Caused by: java.lang.NullPointerException: null
at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:1073) ~[c3p0-0.9.5-pre8.jar:0.9.5-pre8]
... 42 common frames omitted

Logging/config recomendation

I've got a small project setup with SLF4J & Logback and c3p0.

I've created a c3p0.properties file in the root of my app's classpath:

com.mchange.v2.log.MLog = slf4j
c3p0.maxPoolSize=30
c3p0.minPoolSize=10

I'm creating a pooled data source:

ds_unpooled = DataSources.unpooledDataSource(jdbcUrl, jdbcUsername, jdbcPassword);
ds_pooled = DataSources.pooledDataSource(ds_unpooled);

c3po is generating stacktrace noise which I believe is benign, but clutters my logs & console - especially during unit tests. Examples...

java.io.FileNotFoundException: Resource not found at path '/mchange-commons.properties'.
    at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.cfg.BasicMultiPropertiesConfig.<init>(BasicMultiPropertiesConfig.java:110) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.cfg.ConfigUtils.readVmConfig(ConfigUtils.java:115) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.cfg.MLogConfigSource.readVmConfig(MLogConfigSource.java:46) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.log.MLogConfig.refresh(MLogConfig.java:59) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.log.MLog.refreshConfig(MLog.java:59) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.log.MLog.<clinit>(MLog.java:51) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.c3p0.DataSources.<clinit>(DataSources.java:72) ~[c3p0-0.9.5.jar:0.9.5]
java.io.FileNotFoundException: Resource not found at path '/mchange-log.properties'.
    at com.mchange.v2.cfg.BasicPropertiesConfigSource.propertiesFromSource(BasicPropertiesConfigSource.java:64) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.cfg.BasicMultiPropertiesConfig.firstInit(BasicMultiPropertiesConfig.java:185) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.cfg.BasicMultiPropertiesConfig.<init>(BasicMultiPropertiesConfig.java:110) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.cfg.ConfigUtils.read(ConfigUtils.java:63) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.cfg.MConfig$CSManager.recreateFromKey(MConfig.java:153) ~[mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v1.cachedstore.NoCleanupCachedStore.find(NoCleanupCachedStore.java:63) [mchange-commons-java-0.2.9.jar:0.2.9]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_31]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_31]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_31]
    at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_31]
    at com.mchange.v1.lang.Synchronizer$1.invoke(Synchronizer.java:58) [mchange-commons-java-0.2.9.jar:0.2.9]
    at com.sun.proxy.$Proxy2.find(Unknown Source) [na:na]
    at com.mchange.v2.cfg.MConfig.readVmConfig(MConfig.java:75) [mchange-commons-java-0.2.9.jar:0.2.9]
    at com.mchange.v2.c3p0.cfg.C3P0Config.findLibraryMultiPropertiesConfig(C3P0Config.java:157) [c3p0-0.9.5.jar:0.9.5]
    at com.mchange.v2.c3p0.cfg.C3P0Config.<clinit>(C3P0Config.java:143) [c3p0-0.9.5.jar:0.9.5]
    at com.mchange.v2.c3p0.impl.DriverManagerDataSourceBase.<init>(DriverManagerDataSourceBase.java:45) [c3p0-0.9.5.jar:0.9.5]
    at com.mchange.v2.c3p0.DriverManagerDataSource.<init>(DriverManagerDataSource.java:90) [c3p0-0.9.5.jar:0.9.5]
    at com.mchange.v2.c3p0.DriverManagerDataSource.<init>(DriverManagerDataSource.java:86) [c3p0-0.9.5.jar:0.9.5]
    at com.mchange.v2.c3p0.DataSources.unpooledDataSource(DataSources.java:138) [c3p0-0.9.5.jar:0.9.5]

These exceptions are repeated a couple times each. I could play with log levels and package filtering but I'm wondering if these exceptions are inadvertent or planned.

Unable to checkout connection, stack blown due to internal ClassCastException

After upgrade from 0.9.1.2 to 0.9.2.1, the pool is unable to check out connections. It fails each time in the loop in BaseResourcePool due to unexpected ClassCastException in attemptRefurbishResourceOnCheckout, eventually blowing the stack.

Stack trace:

Exception in thread "main" java.lang.StackOverflowError
    at java.lang.Exception.<init>(Exception.java:41)
    at java.lang.RuntimeException.<init>(RuntimeException.java:43)
    at java.lang.ClassCastException.<init>(ClassCastException.java:39)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$C3P0PooledConnectionNestedLockLockFetcher.getInUseLock(C3P0PooledConnectionPool.java:127)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishResourceOnCheckout(C3P0PooledConnectionPool.java:298)
    at com.mchange.v2.resourcepool.BasicResourcePool.attemptRefurbishResourceOnCheckout(BasicResourcePool.java:1682)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:528)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:563)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:563)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:563)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:563)
// ... and so on

The root cause seems to be:

013-05-13 06:18:12 [main] DEBUG: A resource could not be refurbished for checkout. [com.mchange.v2.c3p0.impl.C3P0PooledConnection@5a296cad]
java.lang.ClassCastException: com.mchange.v2.c3p0.impl.C3P0PooledConnection cannot be cast to com.mchange.v2.c3p0.impl.NewPooledConnection

initialPoolSize configuration doen't work in tomcat

Hi,
we have this configuration for our data source in tomcat 6:

Resource acquireIncrement="1" acquireRetryAttempts="2" auth="Container" debugUnreturnedConnectionStackTraces="true" description="Connessione GTA" driverClass="oracle.jdbc.driver.OracleDriver" factory="org.apache.naming.factory.BeanFactory" jdbcUrl="jdbc:oracle**" maxPoolSize="20" maxStatementsPerConnection="10" minPoolSize="5" name="jdbc/**" password="_" type="com.mchange.v2.c3p0.ComboPooledDataSource" unreturnedConnectionTimeout="180" user="_" checkoutTimeout="10" initialPoolSize="10"

When tomcat start the datasource doesn't load the initial connection (10) and the first request of getConnection throw an error for timeout (10 milliseconds). The initial pool is created after the first request.

If I use JMX to execute un hard reset the pool load the initial connections without getConnection call.

Sincerally

Claudio

Apparent Deadlock warning raised when pulling out network cable

hi,

I have done a simple experiment on my local machine to determine whether my system would recover from a network issue: with my server (which runs C3p0) running on it, I pulled out the network cable.

My server uses C3p0 to manage connections to a database running locally (hence not affected by the network cable being unplugged) and also to manage connections to 2 external databases which were obviously affected.

I am attaching a text file which shows the stacktrace obtained.

It says "APPARENT DEADLOCK".

That's kind of scary right? Either the deadlock detection code is not right or there is an actual deadlock somewhere and that's not right either :)

thanks,
Michele

----------------- (apparently you can not attach text file so forgive me for the long dump here ------------

09:45:35.075|WARN |eadPoolAsynchronousRunner|| com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@5df21dc3 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
09:45:35.083|WARN |eadPoolAsynchronousRunner|| com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@5df21dc3 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@3371d99d
on thread: C3P0PooledConnectionPoolManager[identityToken->1hgeut39648xj5f1t8wj22|4ab550d5, dataSourceName->tracker/iod/tracker_connections_pool]-HelperThread-#1
com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@275895c2
on thread: C3P0PooledConnectionPoolManager[identityToken->1hgeut39648xj5f1t8wj22|4ab550d5, dataSourceName->tracker/iod/tracker_connections_pool]-HelperThread-#0
com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@30a57d3d
on thread: C3P0PooledConnectionPoolManager[identityToken->1hgeut39648xj5f1t8wj22|4ab550d5, dataSourceName->tracker/iod/tracker_connections_pool]-HelperThread-#2
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@2a2ed0ed
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@493bb6ef
Pool thread stack traces:
Thread[C3P0PooledConnectionPoolManager[identityToken->1hgeut39648xj5f1t8wj22|4ab550d5, dataSourceName->tracker/iod/tracker_connections_pool]-HelperThread-#1,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:150)
java.net.SocketInputStream.read(SocketInputStream.java:121)
java.io.DataInputStream.readFully(DataInputStream.java:195)
java.io.DataInputStream.readFully(DataInputStream.java:169)
net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:850)
net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:731)
net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477)
net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114)
net.sourceforge.jtds.jdbc.ResponseStream.peek(ResponseStream.java:99)
net.sourceforge.jtds.jdbc.TdsCore.wait(TdsCore.java:4127)
net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1086)
net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:493)
net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1427)
com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyStatement.java:249)
com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:262)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:509)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:451)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:443)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishIdleResource(C3P0PooledConnectionPool.java:433)
com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:2196)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Thread[C3P0PooledConnectionPoolManager[identityToken->1hgeut39648xj5f1t8wj22|4ab550d5, dataSourceName->tracker/iod/tracker_connections_pool]-HelperThread-#0,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:150)
java.net.SocketInputStream.read(SocketInputStream.java:121)
java.io.DataInputStream.readFully(DataInputStream.java:195)
java.io.DataInputStream.readFully(DataInputStream.java:169)
net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:850)
net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:731)
net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477)
net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114)
net.sourceforge.jtds.jdbc.ResponseStream.peek(ResponseStream.java:99)
net.sourceforge.jtds.jdbc.TdsCore.wait(TdsCore.java:4127)
net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1086)
net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:493)
net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1427)
com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyStatement.java:249)
com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:262)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:509)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:451)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:443)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishIdleResource(C3P0PooledConnectionPool.java:433)
com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:2196)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Thread[C3P0PooledConnectionPoolManager[identityToken->1hgeut39648xj5f1t8wj22|4ab550d5, dataSourceName->tracker/iod/tracker_connections_pool]-HelperThread-#2,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:150)
java.net.SocketInputStream.read(SocketInputStream.java:121)
java.io.DataInputStream.readFully(DataInputStream.java:195)
java.io.DataInputStream.readFully(DataInputStream.java:169)
net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:850)
net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:731)
net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477)
net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114)
net.sourceforge.jtds.jdbc.ResponseStream.peek(ResponseStream.java:99)
net.sourceforge.jtds.jdbc.TdsCore.wait(TdsCore.java:4127)
net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1086)
net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:493)
net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1427)
com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyStatement.java:249)
com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:262)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:509)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:451)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:443)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishIdleResource(C3P0PooledConnectionPool.java:433)
com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:2196)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

Exception thrown when commiting

Hi,
I'm using c3p0 with JPA and Hibernate.

I'm doing anything fancy, but from time to time when I have a db operation from a dao, i get this:

org.springframework.orm.jpa.JpaSystemException: could not prepare statement; nested exception is org.hibernate.exception.GenericJDBCException: could not prepare statement
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:303)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:214)
    at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:519)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:496)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:276)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
    at com.chat.dao.UserDAO$$EnhancerBySpringCGLIB$$2ba72b5c.update(<generated>)
    at com.chat.atmosphere.EventHandler.onDisconnect(EventHandler.java:94)
    at com.chat.atmosphere.NativeSocketIOAtmosphereHandler.onDisconnect(NativeSocketIOAtmosphereHandler.java:106)
    at org.atmosphere.socketio.transport.SocketIOSessionManagerImpl$SessionImpl.onDisconnect(SocketIOSessionManagerImpl.java:412)
    at org.atmosphere.socketio.transport.SocketIOSessionManagerImpl$SessionImpl.onShutdown(SocketIOSessionManagerImpl.java:435)
    at org.atmosphere.socketio.transport.WebSocketTransport$SocketIOWebSocketSessionWrapperImpl.abort(WebSocketTransport.java:231)
    at org.atmosphere.socketio.transport.SocketIOSessionManagerImpl$SessionImpl.sendHeartBeat(SocketIOSessionManagerImpl.java:228)
    at org.atmosphere.socketio.HeartBeatSessionMonitor$1.call(HeartBeatSessionMonitor.java:38)
    at org.atmosphere.socketio.HeartBeatSessionMonitor$1.call(HeartBeatSessionMonitor.java:35)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.hibernate.exception.GenericJDBCException: could not prepare statement
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:196)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:96)
    at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.buildBatchStatement(AbstractBatchImpl.java:152)
    at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.getBatchStatement(AbstractBatchImpl.java:141)
    at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3232)
    at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3183)
    at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3525)
    at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:159)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:465)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:351)
    at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350)
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)
    at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1222)
    at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:425)
    at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
    at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:177)
    at org.hibernate.jpa.internal.TransactionImpl.commit(TransactionImpl.java:77)
    at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:515)
    ... 22 more
Caused by: java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.InterruptedException
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77)
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:74)
    at com.mchange.v2.c3p0.stmt.GooGooStatementCache.acquireStatement(GooGooStatementCache.java:579)
    at com.mchange.v2.c3p0.stmt.GooGooStatementCache.checkoutStatement(GooGooStatementCache.java:204)
    at com.mchange.v2.c3p0.impl.NewPooledConnection.checkoutStatement(NewPooledConnection.java:321)
    at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:1086)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$1.doPrepare(StatementPreparerImpl.java:103)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186)
    ... 39 more
Caused by: java.lang.InterruptedException
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:503)
    at com.mchange.v2.c3p0.stmt.GooGooStatementCache.acquireStatement(GooGooStatementCache.java:569)
    ... 44 more

hibernate version : 4.3.8.Final
hibernate-c3p0 version : 4.3.8.Final
com.mchange.c3p0 version : 0.9.5-pre10

persistence.xml c3p0 properties

    <property name="hibernate.c3p0.min_size" value="5" />
    <property name="hibernate.c3p0.max_size" value="200" />
    <property name="hibernate.c3p0.timeout" value="3600" />
    <property name="hibernate.c3p0.max_statements" value="50" />
    <property name="hibernate.c3p0.idleConnectionTestPeriod" value="60" />
    <property name="hibernate.c3p0.preferredTestQuery" value="Select 1;" />
    <property name="hibernate.c3p0.testConnectionOnCheckout" value="true" />
    <property name="connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" />

Ability to establish connections at startup

Hi,

I have an application server that receives and processes commands. Processing the commands sometimes requires accessing the database. When my application server starts, the first received command may take time to be processed and this is because the connections don't seem to be initialized when the pool is created.

After looking at the code, I found that the C3P0PooledConnectionPoolManager is initialized the first time getConnection is called.

Is there a way to initialize the pool manager at startup?

Thanks,
Mickael

Add a hook when the pool fails to acquire a connection

Hi,
My business requirement is: "I need to send an email when something goes wrong with the database".
How can I do that?

I created a customized ConnectionTester (http://www.mchange.com/projects/c3p0/#connectionTesterClassName) that sends an email when an error arises, but the ConnectionTester is only invoked after the Connection is acquired from the database.
For example the ConnectionTester is not invoked when:
A) The ComboPooledDataSource is configured with a user with a misconfigured password.
B) The ComboPooledDataSource is configured with a user that does not exists in the database.

Can we add a new method to ConnectionCustomizer interface (http://www.mchange.com/projects/c3p0/#connectionCustomizerClassName) ?
For example add a method called:

    public void onAcquireError( Connection c, Throwable t) throws Exception;

This method should be invoked when is not possible to acquire the Connection.

Do you see any alternatives to dealing with the scenarios A) and B) ?

Regards,
Martín.

Note: I'm working with mysql.

Excessive logging and avoidable system load as the result of verbose reflection-based ToString method for AbstractComboPooledDataSource

When c3p0 is used via proxy (e. g. Spring LazyConnectionDataSourceProxy), logging of c3p0 operations starts to generate insane amount of logs and generate noticeable load due to datasource'o toString method use for logging (which makes heavy usage of expensive reflections), which is an expected usage for ToString method. Wouldn't it make sense to move verbose information output to some specific method (toStringDebug or something) that is less likely to be used often in production environment?

0.9.2-pre2 libs not available via maven

As per the c3p0 website libs are at:
Note: Coordinates of this version on the Maven central repository: [groupId: com.mchange, artifactId: c3p0, version: 0.9.2-pre2]

These do not seem to work.

SourceForge history imported, what do you think?

I pulled all your SourceForge zips into a Git history and spliced it underneath your new GitHub history.

I put you as the author of all the snapshots from SourceForge, and I put the Author Date as the latest timestamp inside each of the source zips.

Have a look at jdsumsion/c3p0@1e842fe and let me know what you think. I reproduced all the tags (by the name of the zip), and retagged the commits that you had tagged after splicing the GitHub history on top.

If you like what you see, feel free to reset --hard to it and push it up to your repo. If not, then I'll maintain the split history, because people still ask me for my back patches and I want to be able to have somewhere to publish those.

Thanks for such a great library! It's the best and most flexible JDBC connection pool, hands down.

Is Connection.setSchema() (JDBC4) supported?

Hi,
I've tried using Connection.setSchema() in my code but got an AbstractMethodError exception:

java.lang.AbstractMethodError: com.mchange.v2.c3p0.impl.NewProxyConnection.setSchema(Ljava/lang/String;)V

This occurs with version 0.9.5-pre2 and 0.9.5-pre3-SNAPSHOT.
So is Connection.setSchema() supposed to be supported?

C3P0 should allow use of injected Executor

hi,
This is not really an issue, more of a feature request.

C3P0 creates a lot of threads to manage connection pools.
It uses java.util.Timer to perform certain tasks and it seems to create its own pools of threads.

I would argue that such situation is not optimal.

It should be possible to instantiate C3P0 passing your own instance of ScheduledThreadPoolExecutor and timer-like tasks should be scheduled on it rather than on the less efficient java.util.Timer.

I am attaching a screenshot that shows how many threads are created by C3P0 with only 4 connections pools.

If the project leads believe this to be a worthy effort I can consider contributing it myself.

thanks,
Michele

c3p0_threads

The connection is closed Exception

I keep getting this error saying "A PooledConnection that has already signalled a Connection error is still in use!" I know this probably has nothing to do with c3p0, but is there a strategy to work around this? I did setup the test properties in c3p0.

Is there a way the connection can be just abandon when this exception happens
"com.mchange.v2.c3p0.impl.NewPooledConnection (NewPooledConnection.java:425) - [c3p0] A PooledConnection that has already signalled a Connection error is still in use!" ???

Thanks,
















Here is the exception:
2013-05-09 10:28:05,263 [http-nio-8443-exec-1] WARN com.mchange.v2.c3p0.impl.NewPooledConnection (NewPooledConnection.java:425) - [c3p0] A PooledConnection that has already signalled a Connection error is still in use!
2013-05-09 10:28:05,263 [http-nio-8443-exec-1] WARN com.mchange.v2.c3p0.impl.NewPooledConnection (NewPooledConnection.java:426) - [c3p0] Another error has occurred [ com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. ] which will not be reported to listeners!
com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:388)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.clearWarnings(SQLServerConnection.java:2145)
at com.mchange.v2.c3p0.impl.NewProxyConnection.clearWarnings(NewProxyConnection.java:933)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.handleAndClearWarnings(SqlExceptionHelper.java:268)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logAndClearWarnings(SqlExceptionHelper.java:247)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.