ServletContextListener and WS (Servlet) initialization

From: Kresimir Kers (ZG/ETK) <"Kresimir>
Date: Mon, 13 Dec 2004 11:24:08 +0100

Hello all,

I have one question regarding ServletContextListener and Servlet initialization. I know that this is maybe question for some other list but mechanism of Context Listeners is used in implementation of JAX-RPC and I have some problems in that manner.

And now the question.

When is contextInitialized() method of ServletContextListener called. Is it after init(ServletContext sc) method of Servlet class returns or at some other point.

I have problem with that because when I use JAX-RPC (from JWSDP 1.3 bundle) on Tomcat or Sun JES App Server 7 it seems that container calls ServletContextListener before or while init(...) function of Servlet class is executing. This works fine and WS is properly initialized.
When I tried to use JAX-RPC on BEA WebLogic 8.1 app server it seems that ServletContextListener methods are not called until init(...) method of Servlet class returns. This cause errors in WS initialization because some attributes that are set in ContextListener are read in init(...) function of servlet class.

According to Servlet specification contextInitialized(...) method should be called when Servlet is initialized and I understand that this is after init(...) method returns.