Project: Tomcat
Bug 42934 sessionDidActivate() called before contextInitialized()
Reported: 2007-07-18 14:40:10 | Status: resolved fixed

I'm using Seam and a Seam app depends upon the Seam application being initialized before you can do much of anything in Seam. That said Seam puts some hooks into the sessionDidActivate() and sessionDidPassivate() events. Because of that when I start up my app I'm getting a Seam IllegalStateException because the contextInitialized() event is fired after sessionDidActivate() so Seam is not yet initialized it's Session hooks are being fired. What makes me think this is a bug is that sessionWillPassivate() is being correctly called before contextDestroyed() so it would seem that sessionDidActivate() being called before contextInitialized() would be inconsistent behavior. So to sum up I think tomcat should fire context and session events in the following order: contextInitialized sessionDidActivate sessionWillPassivate contextDestroyed As a side note Tomcat 5 follows what I think is the completely wrong but consistent order by firing events in this order: sessionDidActivate contextInitialized contextDestroyed sessionWillPassivate

Files changed in fix:
java/org/apache/catalina/core/StandardContext.java