MRM-1066 - Shutdown of Tomcat causes Exception when running Archiva Project

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@744785 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James William Dumay 2009-02-16 00:28:50 +00:00
parent fa4039e25f
commit db5102aaaf
1 changed files with 9 additions and 1 deletions

View File

@ -26,6 +26,8 @@ import org.apache.maven.archiva.common.ArchivaException;
import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
import org.codehaus.plexus.spring.PlexusToSpringUtils;
import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
@ -59,6 +61,12 @@ public class ArchivaStartup
}
}
public void contextDestroyed(ServletContextEvent contextEvent) {
public void contextDestroyed(ServletContextEvent contextEvent)
{
ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(contextEvent.getServletContext());
if (applicationContext != null && applicationContext instanceof ClassPathXmlApplicationContext)
{
((ClassPathXmlApplicationContext)applicationContext).close();
}
}
}