|
From: Roman R. <r.r...@we...> - 2005-04-25 15:13:56
|
> Hi Roman, > > As we have heard about this rather strange behavior before, ContextLoader > has been reworked for 1.2 RC2: It keeps a reference to the root > WebApplicationContext instance that it creates now, closing exactly that > context instance on shutdown of the web application. > > Hence, it doesn't matter anymore whether the ServletContext attribute is > still available when ContextLoaderListener gets called. Arguably, the > Servlet engine should remove the ServletContext attributes *after* calling > all listeners (which all Servlet engines seemed to do) - but we're not > relying on that behavior anymore now. > > Please give Spring 1.2 RC2 a try and let me know whether it works for you! > > Juergen Yes, with RC2 it=B4s working fine. No problems anymore. Thanks! Roman > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...]On Behalf > Of Roman Roelofsen > Sent: Friday, April 22, 2005 11:21 PM > To: spr...@li... > Subject: [Springframework-developer] DisposableBean / destroy-method -> > never gets called > > > Hi Spring developers! > > I=B4m using Spring for my current WebApp project and I found a strange > behaviour of Spring. > > I=B4m not sure if I=B4m doing something wrong or if it=B4s a bug. So, per= haps you > can take a look at. > > First, here is my posting in the Spring forum which describes my problem: > http://forum.springframework.org/viewtopic.php?t=3D5003 > > I tried to debug Spring to track the problem down. Here=B4s what I have: > > 1. All beans which are implementing the interface DisposableBean are stor= ed > in the map AbstractBeanFactory.disposableBeans. But the method > AbstractBeanFactory.destroySingletons() gets only called for the factory > "-servlet.xml", not for the other two xml files. > > 2. On shutdown, ContextLoaderListener.contextDestroyed() calls > ContextLoader.closeWebApplicationContext(). But > > servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CO= NT >E XT_ATTRIBUTE); > > always returns null. Perhaps the ServletContext is destroyed when the > Listener gets informed? While my app is running, > > servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CO= NT >E XT_ATTRIBUTE); > > returns the correct application context. > > I=B4m shutting down my webapp with the url: > http://localhost:8080/manager/stop?path=3D/mywebapp > > My environment: > Tomcat 5.5.7 > Java 1.5 > Spring 1.2RC1 > > Please let me know if you need more information. > > > Best regards, > > Roman |