Bug 49812 - Order of context listeners in web.xml is not preserved
Order of context listeners in web.xml is not preserved
Status: RESOLVED INVALID
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
6.0.29
PC All
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-08-23 18:21 UTC by Vlad Skarzhevskyy
Modified: 2010-08-23 23:02 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vlad Skarzhevskyy 2010-08-23 18:21:48 UTC
We 3 context listens for app initialization.

web.xml fragment

   <listener>
        <listener-class>com.GwtAppConfiguratorContextListener</listener-class>
    </listener>

    <listener>
	    <listener-class>com.SessionCounter</listener-class>
    </listener>

    <listener>
        <listener-class>com.AppStartedContextListener</listener-class>
    </listener>

The order in Tomcat 6.0.20 is preserver.
In newer versions it is broken.

I tested with v6.0.26 and v6.0.29
Comment 1 Vlad Skarzhevskyy 2010-08-23 19:09:35 UTC
The problem probably not be in Tomcat version.

I installed 6.0.20 on Win7-64 Using 32 bit Sun JVM  still the same problem.
(JVM tested jdk1.6.0_18 and jdk1.6.0_21)

Apache Tomcat/6.0.29  	1.6.0_21-b06  	Sun Microsystems Inc.  	Windows 2003 x86

Order of firing context listeners is invalid. The last called before first.


I have working production configurations (that I want to upgrade)
This have proper order of listeners 
------
Apache Tomcat/6.0.20  	1.6.0_02-b06  	BEA Systems, Inc.  	Windows 2003 x86
Apache Tomcat/6.0.20  	1.6.0_21-b06  	Sun Microsystems Inc.  	Windows 2003 x86
Comment 2 Chuck Caldarale 2010-08-23 19:24:06 UTC
(In reply to comment #1)
> Order of firing context listeners is invalid. The last called before first.

Which APIs are you testing?  For the contextDestroyed() method, the last specified ServletContextListener should be called before the first.

 - Chuck
Comment 3 Vlad Skarzhevskyy 2010-08-23 20:01:00 UTC
Two Listener are implementations of javax.servlet.ServletContextListener

And I I look at function contextInitialized();

First AppConfiguratorContextListener
Second AppStartedContextListener

Source https://pyx4j.com/svn/pyx4j/pyx4j-gwt/pyx4j-server/src/main/java/com/pyx4j/server/servlet/

The second throw exception when the first one not initialized.

if (!AppConfiguratorContextListener.initialized) {
throw new Error("AppConfiguratorContextListener was not initialized");
}


---
 No errors in stdout
---
I do deply the same war to different configurations.
Comment 4 Vlad Skarzhevskyy 2010-08-23 23:02:02 UTC
Sorry.
 This was my mistake.

 I have not noticed the java.lang.NoClassDefFoundError in localhost.2010-08-23.log
 I was expecting it in stderr_20100823.log ...


Sorry again!