I have connection issues since i decided to use c3p0 pooling.
persistence.xml
<property name="hibernate.connection.url" value="jdbc:mysql://***.***.***.***:****/*****"/>
<property name="hibernate.connection.username" value="****"/>
<property name="hibernate.connection.password" value="****"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.show_sql" value="true" />
<!-- <property name="hibernate.connection.provider_class" value="org.hibernate.c3p0.internal.C3P0ConnectionProvider" /> -->
<!-- <property name="hibernate.c3p0.min_size" value="1"/> -->
<!-- <property name="hibernate.c3p0.max_size" value="50"/> -->
<!-- <property name="hibernate.c3p0.timeout" value="10000"/> -->
<!-- <property name="hibernate.c3p0.max_statements" value="100"/> -->
<!-- <property name="hibernate.c3p0.idle_test_period" value="300"/> -->
With this config everything works fine. When i uncomment the c3p0 properties i cant even connect to my application.
try {
user = UserDAO.connect(login,Tools.encode(password));
}
catch (SQLException e) {
e.printStackTrace();
logger.error(utils.Constants.GENERAL_ERROR);
message=utils.Constants.LOGIN_KO;
}
finally{
//some code
}
I tried to run this code in debug. I have a break point on each block. The program directly go from the try to the finally. Here are the logs:
2015-08-26 15:27:50 INFO LogHelper:46 - HHH000204: Processing PersistenceUnitInfo [
name: ****
...]
2015-08-26 15:27:53 INFO Version:54 - HHH000412: Hibernate Core {4.3.6.Final}
2015-08-26 15:27:53 INFO Environment:239 - HHH000206: hibernate.properties not found
2015-08-26 15:27:53 INFO Environment:346 - HHH000021: Bytecode provider name : javassist
2015-08-26 15:27:56 INFO Version:66 - HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2015-08-26 15:27:56 INFO ConnectionProviderInitiator:190 - HHH000130: Instantiating explicit connection provider: org.hibernate.c3p0.internal.C3P0ConnectionProvider
2015-08-26 15:27:56 INFO C3P0ConnectionProvider:117 - HHH010002: C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://***.***.***.***:****/*****
2015-08-26 15:27:56 INFO C3P0ConnectionProvider:118 - HHH000046: Connection properties: {user=****, password=****}
2015-08-26 15:27:56 INFO C3P0ConnectionProvider:121 - HHH000006: Autocommit mode: false
I see there is this line in the logs
Environment:239 - HHH000206: hibernate.properties not found
But i dont understand where it comes from and if it is the reason of the issue. I already looked at how to fix the error: "INFO: HHH000206: hibernate.properties not found"? and similar posts
@Maciej Dobrowolski I dont use Maven so i dont have pom.xml (i wont explain why here it is not related) Here are the jars i have in the classpath:
/WebContent/WEB-INF/lib/hibernate-c3p0-5.0.0.Final.jar
/WebContent/WEB-INF/lib/hibernate-commons-annotations-4.0.5.Final.jar
/WebContent/WEB-INF/lib/hibernate-core-4.3.6.Final.jar
/WebContent/WEB-INF/lib/hibernate-entitymanager-4.3.6.Final.jar
/WebContent/WEB-INF/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar
/WebContent/WEB-INF/lib/c3p0-0.9.5.1.jar