Pessoal, tenho uma aplicação console que utiliza o Hibernate para persistência. Transformei a danada em serviço pelo Java Service Wrapper e deixei rodando no server. Depois de 2 dias fui verificar o log do hibernate e tinha o seguinte:
[ERROR] - JDBCExceptionReporter - The last packet successfully received from the server was161468 seconds ago.The last packet sent successfully to the server was 161468 seconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
Meu hibernate config está configurado para trabalhar com o C3p0 (Pelo menos eu acho) segue o mesmo:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">xxxxxxxxxxxx</property>
<property name="hibernate.connection.username">xxxxxxxxx</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.connection.password">xxxxxxxxxxxx</property>
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">100</property>
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">100</property>
<property name="hibernate.connection.autocommit">false</property>
<mapping class="xxxxxxxxxxxxxxxxxxxxx"/>
</session-factory>
</hibernate-configuration>
Perguntas:
1 - Como ter certeza que a conexão esta sendo feita e gerenciada pelo C3P0 ?
2 - Alguém ja teve esse problema ?? Realmente preciso alterar a configuração mencionada no erro ??
Valew pessoal