Hi, I'm using camel version 2.16.1 with openjdk 1.7, hibernate 5.0.3 and postgres JDBC 9.4-1205.
I have a JPA consumer configured like that: <route id="queue"> <from uri="jpa:ch.xxx.ExploitationQueue?consumeLockEntity=false&consumer.delay=1000&maxMessagesPerPoll=1&consumer.query=from ch.xxx.ExploitationQueue order by id"/> ... </route> JPA is configured like that: <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> <property name="persistenceUnitName" value="persistenceUnit"/> </bean> <bean id="jpaTxManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent"> <property name="entityManagerFactory" ref="entityManagerFactory"/> <property name="transactionManager" ref="jpaTxManager"/> </bean> And my persistence.xml looks like that: <persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL"> <properties> <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" /> <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://db/ZZZZZ" /> <property name="javax.persistence.jdbc.user" value="www-data" /> <property name="javax.persistence.jdbc.password" value="XXXXXX" /> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL9Dialect" /> <property name="hibernate.connection.autoReconnect" value="true" /> <property name="hibernate.connection.autoReconnectForPools" value="true" /> <property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" /> <property name="hibernate.c3p0.max_size" value="10" /> <property name="hibernate.c3p0.min_size" value="1" /> <property name="hibernate.c3p0.acquire_increment" value="1" /> <property name="hibernate.c3p0.idle_test_period" value="300" /> <property name="hibernate.c3p0.max_statements" value="0" /> <property name="hibernate.c3p0.timeout" value="100" /> <property name="hibernate.c3p0.validate" value="true" /> <property name="hibernate.c3p0.testConnectionOnCheckout" value="true" /> <property name="hibernate.c3p0.breakAfterAcquireFailure" value="false" /> </properties> </persistence-unit> In a nominal case, everything works fine. If I bounce my database server Camel doesn't reconnect to the database and I have logs like that: 11:17:49.756 [Camel (xxx) thread #0 - jpa://ch.xxx.ExploitationQueue] DEBUG o.h.e.t.internal.TransactionImpl - begin 11:17:49.761 [Camel (xxx) thread #0 - jpa://ch.xxx.ExploitationQueue] DEBUG org.hibernate.SQL - select exploitati0_.id as id1_0_, exploitati0_.query as query2_0_, exploitati0_.uuid as uuid3_0_ from exploitation_queue exploitati0_ order by exploitati0_.id 04-Jan-2016 11:17:49.761 WARNING [Camel (xxx) thread #0 - jpa://ch.xxx.ExploitationQueue] com.mchange.v2.c3p0.impl.NewPooledConnection.handleThrowable [c3p0] A PooledConnection that has already signalled a Connection error is still in use! 04-Jan-2016 11:17:49.762 WARNING [Camel (xxx) thread #0 - jpa://ch.xxx.ExploitationQueue] com.mchange.v2.c3p0.impl.NewPooledConnection.handleThrowable [c3p0] Another error has occurred [ org.postgresql.util.PSQLException: This connection has been closed. ] which will not be reported to listeners! org.postgresql.util.PSQLException: This connection has been closed. So looks like the connection pool is not re-connecting the DB because the connection is still in use. I've looked all over the place at every level, did a lot of tunning and found no solution to that. Anybody have an idea on how to have JPA reconnect to the DB automatically? Thanks.