Error starting C3P0 connection pool

Asked

Viewed 903 times

1

I configured C3P0 and at start the error occurs below.

WARN [com.mchange.v2.resourcepool.Basicresourcepool] com.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 ahead.

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 complete 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 [com.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 Solation level: 2017-01-16 08:19:05,406 INFO [com.mchange.v2.c3p0.impl.Abstractpoolbackeddatasource] Initializing c3p0 pool... com.mchange.v2.c3p0.Poolbackeddatasource@c 6839eba [ connectionPoolDataSource -> com.mchange.v2.c3p0.Wrapperconnectionpooldatasource@f 2d2b84b [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClaseName -> 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 -> com.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.envers.boot.Internal.Enversserviceimpl] (Serverservice Thread Pool -- 60) Envers Integration enabled? : true 2017-01-16 08:19:35,446 WARN [com.mchange.v2.resourcepool.Basicresourcepool] com.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 com.mchange.v2.c3p0.DriverManagerDataSource.driver(Drivermanagerdatasource.java:285) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(Drivermanagerdatasource.java:161) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(Wrapperconnectionpooldatasource.java:161) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(Wrapperconnectionpooldatasource.java:147) at com.mchange.v2.c3p0.impl.C3p0pooledconnectionpool$1PooledConnectionResourcePoolManager.acquireResource(C3p0pooledconnectionpool.java:202) at com.mchange.v2.resourcepool.Basicresourcepool.doAcquire(Basicresourcepool.java:1138) at com.mchange.v2.resourcepool.Basicresourcepool.doAcquireAndDecrementPendingAquiresWithinLockOnSuccess(Basicresourcepool.java:1125) at com.mchange.v2.resourcepool.Basicresourcepool.access$700(Basicresourcepool.java:44) at com.mchange.v2.resourcepool.Basicresourcepool$Scatteredacquiretask.run(Basicresourcepool.java:1870) at com.mchange.v2.async.Threadpoolasynchronousrunner$Poolthread.run(Threadpoolasynchronousrunner.java:696)

  • 1

    For a moment I thought you were looking to turn on a Star Wars robot.

1 answer

1


I discovered that the problem occurred because the C3P0 was not recognizing the paramenters "javax.persistence".

I switched to equivalent "Hibernate.Connection" parameters 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" />

Afterward

<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"/>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.