|
From: Juergen H. <ju...@in...> - 2005-04-24 13:41:51
|
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 -----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´m using Spring for my current WebApp project and I found a strange behaviour of Spring. I´m not sure if I´m doing something wrong or if it´s a bug. So, perhaps 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=5003 I tried to debug Spring to track the problem down. Here´s what I have: 1. All beans which are implementing the interface DisposableBean are stored 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_CONTE 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_CONTE XT_ATTRIBUTE); returns the correct application context. I´m shutting down my webapp with the url: http://localhost:8080/manager/stop?path=/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 ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=ick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |