C3P0 dont work (org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider)

You’re welcome. Enjoy reading all the resources I mentioned.

Hi vlad, I learned how to use it and I did what you say. And I only have 1 version of hibernate core. So, the problem is the same that at the begin.

Sin%20t%C3%ADtulo

Therefore, discarding the option of an earlier version of Hibernate in my classpath. What could happen?

Now, check the WAR that gets build and also the web or application server. Maybe the server supplies an old Hibernate dependency on the classpath.

With application Server , do you refer to tomcat server,no?

That’s the web server, yes. Check it out as well. Also, open it in debug mode and see where the Hibernate classes are loaded from.

Okey, thanks again vlad!

Hi vlad! You was right . Tomcat server loads other hibernate core (4.0.1). But this isnt on the repositories, dependencies or en tomcat libs. And in console this dont show from where is loaded.
Do you have an idea of why could it happens?

In debug, use Evaluate Expression to execute this:

Class clazz = Session.class;
URL location = clazz.getResource( '/' + clazz.getName().replace( '.', '/') + ".class");

You will find the JAR that loaded a particular Java class.

Hi @vlad! Finally it works! If when I run the app I dont see anything about c3p0 on stacktrace, this mean that c3p0 is working,no?

Add a breakpoint in the C3P0ConnectionPeovider to be sure.

INFORMACIÓN: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
sep 28, 2018 9:45:36 PM org.hibernate.c3p0.internal.C3P0ConnectionProvider configure
INFO: HHH10001007: JDBC isolation level: <unknown>
sep 28, 2018 9:45:36 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFORMACIÓN: Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@ca19da3c [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@af9e52f8 [ acquireIncrement -> 1, acquireRetryAttempts -> 1, acquireRetryDelay -> 250, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge1439y9crqdg1kfrgln|56bb20f, idleConnectionTestPeriod -> 60, initialPoolSize -> 5, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 10, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@b24b4f64 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1hge1439y9crqdg1kfrgln|5630603, jdbcUrl -> jdbc:mysql://*.*.*.*:3306/Proyect, properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1hge1439y9crqdg1kfrgln|3cb23798, numHelperThreads -> 3 ]
Fri Sep 28 21:45:37 CEST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Fri Sep 28 21:45:37 CEST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Fri Sep 28 21:45:37 CEST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
sep 28, 2018 9:45:38 PM org.hibernate.dialect.Dialect <init>

I think it’s okay, Am I right?

There is the C3P0ConnectionProvider in the log, so it’s ok now.

1 Like

Finally it works hahah Thanks you so much @vlad :slight_smile: Should I mark this post as solved?

Yes, you should. I’m glad you found the solution.