@Override public void contextDestroyed(ServletContextEvent sce) { try { OpenFlameDataSource bean = OpenFlameSpringContext.getBean(OpenFlameDataSource.class); bean.close(); } catch (SQLException e) { e.printStackTrace(); } try { Scheduler scheduler = OpenFlameSpringContext.getBean(Scheduler.class); scheduler.shutdown(); } catch (SchedulerException e) { e.printStackTrace(); } Env.clean(); JAXBContextCache.clearCaches(); ClassFactory.cleanCache(); CachedIntrospectionResults.clearClassLoader(getClass().getClassLoader()); super.contextDestroyed(sce); }