Atomikos Forum

Atomikos lifecycle in Tomcat

If more than one webapp inside Tomcat needs the UserTransactionManager, I run into problems. The first webapp which calls UserTransactionManager.init() is the master. The UserTransactionManager can only be closed by the master. So UserTransactionManager gets closed if the master webapp calls UserTransactionManager.close() and the other webapps lose there UserTransactionManager. So I changed the Lifecycle Listener from the Atomikos website to be the master to solve this issue.

public class AtomikosLifecycleListener
  implements LifecycleListener
{
  private UserTransactionManager utm;

  public void lifecycleEvent(LifecycleEvent event)
  {
    try {
      if (event.getType().equals(Lifecycle.START_EVENT)) {
        if (utm == null) {
          utm = new UserTransactionManager();
          utm.init();
        }
      } else if (event.getType().equals
                (Lifecycle.AFTER_STOP_EVENT)) {
        if (utm != null) {
          utm.close();
        }
      }
    } catch (Exception e) {
      Systerm.err.println("Exception" + e);
    }
  }
}
Rainer Wallscheid Send private email
Tuesday, October 12, 2010
 
 
I have found another entry for this issue from March 2009:

default82df.html?community.6.530.2

It could have saved me a lot of work, if I had found this information earlier.
Rainer Wallscheid Send private email
Thursday, October 14, 2010
 
 
Please feel free to register to contribute to our Atomikos Product Documentation wiki http://www.atomikos.com/Main/AtomikosRegistration
I will assign contributor rights to your account so if you change the Tomcat documentation others can benefit from the updated documentation.
Wout Steurs Send private email
Friday, October 15, 2010
 
 
Registered with WikiName Rainer
Rainer Wallscheid Send private email
Friday, October 15, 2010
 
 
Documentation updated
Rainer Wallscheid Send private email
Friday, October 15, 2010
 
 
Wout Steurs Send private email
Saturday, October 16, 2010
 
 

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

Other recent topics Other recent topics