Atomikos Forum

Unable to restart WAR without restarting Tomcat

I am using the Atomikos transaction manager to handle the 2PC over JMS and JDBC. The JMS implementation is Oracle AQ. Springs DI is used to wire everything up, based on this article:

Everything works fine when the WAR is launched for the first time after the Tomcat app server is started. However, when I want to restart the application without shutting down and restarting Tomcat, I get the following error:

javax.naming.NamingException: Another resource already exists with name AtomikosDataSourceJMSOracle - pick a different name

Atomikos is installed in the Tomcat container and not on the WAR level. I.e. the Atomikos jars and are located in the CATALINA_HOME/lib directory.

I believe the cause for this error to be linked to the fact that the resource AtomikosDataSourceJMSOracle is already present in the IntraVmObjectRegistry, which is handled at J2EE container level. When the WAR is restarted, the IntraVmObjectRegistry remains in memory, but Spring wants to recreate and rewire its beans, creating a second resource with the name AtomikosDataSourceJMSOracle.

Is there a way to bypass this gracefully? Could Spring be configured in such a way that it actually recuperates the existing resource instead of creating a new one?
Rik Gruwez (2) Send private email
Wednesday, December 15, 2010
OK, the problem has been solved. When the application shuts down it needs to call the close() method on the AtomikosConnectionFactoryBean.

This is easily accomplished by adding a destroy-method attribute to the Spring bean definition.

<bean id="aqConnectionFactory"

I can now restarted the web app without the need for restarting Tomcat.
Rik Gruwez (2) Send private email
Wednesday, December 15, 2010
Thanks for the update!
Guy Pardon Send private email
Monday, December 20, 2010

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics