Bug 51344 - org.apache.catalina.startup.Embedded overrides Lifecycle incorrectly?
Summary: org.apache.catalina.startup.Embedded overrides Lifecycle incorrectly?
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.12
Hardware: PC All
: P2 regression (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2011-06-08 21:35 UTC by Jens Deppe
Modified: 2011-06-09 19:04 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Jens Deppe 2011-06-08 21:35:55 UTC
Not sure if this is a bug or just my mis-coding...

I've been using the Embedded component in Tomcat 6.0.29 for integration testing. Something like this:

    server = new EmbeddedTomcat("/test", 7890, "JVM-1");
    PeerToPeerCacheLifecycleListener p2pListener = new PeerToPeerCacheLifecycleListener();
    p2pListener.setProperty("mcast-port", "19991");
    sessionManager = new DeltaSessionManager();

Here the EmbeddedTomcat class is simply a wrapper for Embedded - I'm passing in the context, port and 'JVM route' - nothing special. Then I add a listener which should be the programmatic equivalent of having the following server.xml snippet:

    <Listener className="PeerToPeerCacheLifecycleListener"/>

DeltaSessionManager performs custom session management and thus extends ManagerBase and implements Lifecycle and SessionManager.

During the start of DeltaSessionManager I initialize the listener by doing

    this.lifecycle.fireLifecycleEvent(START_EVENT, null);

The listener picks up this event and starts.

All works nicely under Tomcat 6, but breaks under Tomcat 7.0.12. My initial investigation shows that the LifecycleEvent, being fired, is not reaching the Embedded component which is where the listener is registered.

Removing the overridden Lifecycle methods from Embedded (so that the Lifecyle processing happens in LifecycleBase) seems to work as the triggered event then reaches my listener.
Comment 1 Mark Thomas 2011-06-09 19:04:51 UTC
Thanks for the report and the analysis.

This has been fixed in 7.0.x and will be included in 7.0.16 onwards.