Need to access beans from ContextDestroyed of Custom ServletContextListener ---------------------------------------------------------------------------
Key: JS2-1269 URL: https://issues.apache.org/jira/browse/JS2-1269 Project: Jetspeed 2 Issue Type: Bug Components: Components Core Affects Versions: 2.2.0 Reporter: Lavanya In the contextDestroyed of custom ServletContextListener, we need to log the application shutdown and we should be able to access some beans for that purpose.But the webapplication context found was FilteringWebApplicationContext. It seems like its bean factory is null and I see the following error when trying to access a bean SEVERE: Exception sending context destroyed event to listener instance of class our.package.StartupShutdownLoggingListener java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:153) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:880) at our.package.StartupShutdownLoggingListener.contextDestroyed(StartupShutdownLoggingListener.java:26) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4011) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4615) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:924) at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1319) at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1290) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:323) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1086) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098) at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448) at org.apache.catalina.core.StandardService.stop(StandardService.java:587) at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744) at org.apache.catalina.startup.Catalina.stop(Catalina.java:648) at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:692) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: jetspeed-dev-unsubscr...@portals.apache.org For additional commands, e-mail: jetspeed-dev-h...@portals.apache.org