In the specification of the Servlet API version 2.4 the method contextInitialized() in the interface ServletContextListener is defined as follows:
Notification that the web application is ready to process requests. All ServletContextListeners are notified of context initialisation before any servlet in the web application is initialized.
However, through logging it can be observed that in the WebAS Java implementation of the Servlet API a ServletContextListener is notified of contextInitialized() AFTER some sevlets have been initialized.
I presume the reason is that WebAS Java implements the version 2.3 of the specification, which doesn't define the order of events quite so well.
Question 1. Is there a workaround, i.e. how can one get a ServletContextEvent BEFORE any servlet is initialized?
Question 2. Does SAP plan to support the version 2.4 of the Servlet API? When can we expect this?
Web AS 6.40 is J2EE 1.3 compliant, hence servlet 2.3 specification is implemented. Yes, J2EE 1.4 (hence, servlet 2.4) support is planned with the next release of NetWeaver, which is scheduled for the second half of the next year.
About the workaround question, I'd try to bring some developers into the discussion.
Ivo is right. Web AS 6.40 is J2EE 1.3 compliant and implements Servlet 2.3 specification. In Servlet 2.3 API its not explicitly said that the contextInitialized() method in ServletContextListener interface should be called before any servlet or filter is initialized. In this release the ServletContextListeners are notified of context initialization after servlet and filter initialization and thus informing them that web application is ready to process requests.
Unfortunately there is no workaround as it is implementation dependent, and of course of reasons for backwards compatibility such changes could not be done.
What concerns your second question is that the J2EE 1.4 (hence, servlet 2.4 API) support is planned for the next release of the Web AS. In that release the contextInitialized event will be thrown before any servlet or filter is initialized.