camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: camel-jpa and PersistenceException
Date Thu, 09 Mar 2017 20:22:21 GMT

You could try to patch the code yourself and run with a camel-jpa JAR
with your code changes to see what you can get working for you, and
then come back here with the code changes for further discussion and
see what we can do for camel-jpa.

On Thu, Mar 9, 2017 at 7:42 PM, jamest <> wrote:
> I am using camel-jpa to poll messages from a database.  As recommended for
> recovery on database failures, the persistence unit is configured with
> Tomcat jdbc connection pool as the datasource and uses a test-on-borrow
> strategy to validate connections.
> The route still fails to recover if the database goes down.  I was able to
> recreate the problem using an HSQL instance that I forced to go down during
> route execution.  The stack trace shows that the PersistenceException is
> thrown from JpaConsumer's doInTransaction().
> As I was researching the problem I came across CAMEL-9608 which introduced
> catching a PersistenceException and forcing the next poll to create a new
> EntityManager.  It only performs this when the PersistenceException is
> thrown from processBatch()
> So my question is, if PersistenceException can be thrown at
> TransactionTemplate.execute() then is there any reason why the try/catch for
> PersistenceException can't wrap this too?
> From reading this forum I know that the JPA component expects the
> EntityManager to handle the connection recovery but I'm not on solid ground
> yet in determining how the EntityManager is supposed to react under these
> circumstances.  It seems like the locally stored EntityManager just doesn't
> give up this bad connection.
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
----------------- @davsclaus
Camel in Action 2:

View raw message