Error starting C3P0 connection pool

I configured C3P0 and when starting the error below occurs.

WARN [com.mchange.v2.resourcepool.BasicResourcePool] with.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@74a41b98 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: java.lang.NullPointerException

Detail, the error occurs in the wildfly 10.1 console but the application itself works. My fear is that the problem connections pool further forward.

My persistence.xml is like this

<properties>

    <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://192.168.1.13:5432/perolaweb" />

    <property name="javax.persistence.jdbc.user" value="user" />
    <property name="javax.persistence.jdbc.password" value="password" />
    <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />

    <property name="hibernate.show_sql" value="false" />

    <property name="hibernate.format_sql" value="true" />
    <property name="hibernate.connection.useUnicode" value="true" />
    <property name="hibernate.connection.characterEncoding" value="UTF-8" />
    <property name="use_sql_comments" value="true" />
    <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />

    <!-- C3P0 -->
    <!-- Connection Pooling settings --> 
    <property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" />
    <property name="hibernate.c3p0.max_size" value="20" /> 
    <property name="hibernate.c3p0.min_size"    value="3" /> 
    <property name="hibernate.c3p0.acquire_increment" value="1"/>
    <property name="hibernate.c3p0.idle_test_period" value="300" />
    <property name="hibernate.c3p0.max_statements" value="50"/> 
    <property name="hibernate.c3p0.timeout" value="300" /> 
</properties>

Below full Error

08:19:05,156 INFO [org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator] (ServerService Thread Pool -- 62) HHH000130: Instantiating explicit connection provider: org.hibernate.connection.C3P0ConnectionProvider 2017-01-16 08:19:05,165 INFO [org.hibernate.c3p0.internal.C3P0ConnectionProvider] HHH010002: C3P0 using driver: null at URL: null 2017-01-16 08: 19: 05,172 INFO [org.hibernate.c3p0.internal.C3P0ConnectionProvider] HHH10001001: Connection properties: {useUnicode=true, characterEncoding=UTF-8} 2017-01-16 08:19:05,173 INFO [org.hibernate.c3p0.internal.C3P0ConnectionProvider] HHH10001003: Autocommit mode: false 2017-01-16 08:19:05,173 WARN [org.hibernate.c3p0.internal.C3P0ConnectionProvider] HHH10001006: No JDBC Driver class was specified by property hibernate.connection.driver_class 2017-01-16 08: 19: 05,194 INFO [with.mchange.v2.log.MLog] Mlog clients using slf4j logging. 2017-01-16 08: 19: 05,333 INFO [com.mchange.v2.c3p0.C3p0registry] Initializing c3p0-0.9.5.2 [built 08-December-2015 22: 06: 04 -0800; debug? true; trace:10] 2017-01-16 08:19: 05,381 INFO [org.hibernate.c3p0.internal.C3P0ConnectionProvider] HHH10001007: JDBC insulation level: 2017-01-16 08:19:05,406 INFO [with.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource] Initializing c3p0 pool... with.mchange.v2.c3p0.PoolBackedDataSource@c6839eba [ connectionPoolDataSource - > with.mchange.v2.c3p0.WrapperConnectionPoolDataSource@f2d2b84b [ acquireIncrement - > 1, acquireRetryAttempts - > 30, acquireRetryDelay - >1000, autoCommitOnClose - > false, automaticTestTable - > null, breakAfterAcquireFailure - > false, checkoutTimeout - > 0, connectionCustomizerClassName - > null, connectionTesterClassName - > with.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource - > caller, debugUnreturnedConnectionStackTraces - > false, factoryClassLocation - > null, forceIgnoreUnresolvedTransactions - > false, forceSynchronousCheckins - > false, identityToken - > 1hgeby99l1a9zqon13hf6ns / 535f06ba, idleConnectionTestPeriod - > 300, initialPoolSize - > 3, maxAdministrativeTaskTime - > 0, maxConnectionAge - >0, maxIdleTime - > 300, maxIdleTimeExcessConnections - > 0, maxPoolSize - > 20, maxStatements - > 50, maxStatementsPerConnection - > 0, minPoolSize - > 3, nestedDataSource - > with.mchange.v2.c3p0.DriverManagerDataSource@80d91f8f [description -> null, driverClass - > null, factoryClassLocation - > null, forceUseNamedDriverClass - > false, identityToken - > 1hgeby99l1a9zqon13hf6ns|aa3bd50, jdbcUrl - > null, properties - > {useUnicode=true, characterEncoding=UTF-8}], preferredTestQuery - > null, privilegeSpawnedThreads - > false, propertyCycle - > 0, statementCacheNumDeferredCloseThreads - > 0, testConnectionOnCheckin - > false, testConnectionOnCheckout - > false, unreturnedConnectionTimeout - >0, usesTraditionalReflectiveProxies - > false; userOverrides: {} ], dataSourceName - > null, extensions - > {}, factoryClassLocation - > null, identityToken - > 1hgeby99l1a9zqon13hf6ns|2538e5e2, numHelperThreads - > 3 ] 08:19:05,452 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 60) HHH000400: using dialect: org.hibernate.dialect.SQLServerDialect 08:19: 05,513 INFO [org.hibernate.upside down.boot.internal.EnversServiceImpl] (ServerService Thread Pool Envers 60) towards integration enabled? : true 2017-01-16 08: 19: 35,446 WARN [com.mchange.v2.resourcepool.BasicResourcePool] with.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@74a41b98 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: java.lang.NullPointerException at org.postgresql.Driver.parseURL (Driver.java:532) at org.postgresql.Driver.acceptsURL (Driver.java:431) at java.sql.DriverManager.Getdriver (DriverManager.java:299) at with.mchange.v2.c3p0.DriverManagerDataSource.driver (DriverManagerDataSource.java:285) at with.mchange.v2.c3p0.DriverManagerDataSource.getConnection (DriverManagerDataSource.java:161) at with.mchange.v2.c3p0.WrapperConnectionPoolDataSource.Getpooledconnection (WrapperConnectionPoolDataSource.java:161) at with.mchange.v2.c3p0.WrapperConnectionPoolDataSource.Getpooledconnection (WrapperConnectionPoolDataSource.java:147) at with.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1pooledconnectionresourcepoolmanager.acquireResource (C3P0PooledConnectionPool.java:202) at with.mchange.v2.resourcepool.BasicResourcePool.doAcquire (BasicResourcePool.java:1138) at with.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquireswithinlockonsuccess (BasicResourcePool.java:1125) at with.mchange.v2.resourcepool.BasicResourcePool.access$700 (BasicResourcePool.java:44) at with.mchange.v2.resourcepool.BasicResourcePool SC ScatteredAcquireTask.run (BasicResourcePool.java:1870) at with.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run (ThreadPoolAsynchronousRunner.java:696)

 1
Author: Marcelo, 2017-01-16

1 answers

I found that the problem occurred because C3P0 was not recognizing the parameters " javax.persistence".

I exchanged for equivalent parameters " hibernate.connection " and the error no longer occurred.

Before

<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://999.999.999.999:5432/aaaaaa" />
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="******" />
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />

After

<property name="hibernate.connection.url" value="jdbc:postgresql://999.999.999.999:5432/aaaaaa" />
<property name="hibernate.connection.username" value="user" />
<property name="hibernate.connection.password" value="******" />
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
 1
Author: Marcelo, 2017-01-19 10:26:42