BTMLifecycleListener shutting down too early

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

BTMLifecycleListener shutting down too early

Thomas Beckmann

I've integrated the bitronix TM into tomcat and created an application with
spring, activemq and camel. I used the ResourceLoader to init a
PoolingDataSource and a PoolingConnectionFactory and made all that available
through jndi.

Everything worked fine except during shutdown.

I've seen that that the
is shutting down the TM and the pools before the ContextLoaderListener of
spring has a chance to destroy the ApplicationContext.
That caused an exception in DefaultMessageListenerContainer saying that the
TransactionManager has already shut down. After that the Container tries to
refresh the lost connection and the PoolingConnectionFactory just
reinitializes on a call to createConnection.
Because of that the pool was up and running again (including one connection
and a corresponding thread from activemq) and that finally prevented the

The BTMLifecycleListener listens to Lifecycle.START_EVENT and
Lifecycle.STOP_EVENT but I think that it should better listen to

I tried this with my own implementation of a LifecycleListener and now
everything works super fine. :-)

Thomas Beckmann

To unsubscribe from this list, please visit:

Reply | Threaded
Open this post in threaded view

Re: BTMLifecycleListener shutting down too early

Ludovic Orban

Thanks for the report and the fix. I've created a JIRA entry to make sure this will be fixed in the next version:

Thanks again,