症状:Tomcat停止后,提示Quartz一堆错,总之就是无法停止,然后tomcat的进程还有残留,要手动再停止一下,不然无法再次运行
(Exception in thread "DefaultQuartzScheduler_Worker-8" java.lang.NoClassDefFoundError: org/apache/log4j/spi/ThrowableInformation)
从_Worker-1~10
一开始看提示还以为是log4j的问题,把版本依次都升高了,还是无效
解决方法:https://blog.csdn.net/liujun_for_java/article/details/78101478?utm_source=blogxgwz5
1、web.xml里配置
2、配置后亲测有效
public class ShutDownQuartz implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent servletContextEvent) { } @Override public void contextDestroyed(ServletContextEvent servletContextEvent) { try { Scheduler defaultScheduler = StdSchedulerFactory.getDefaultScheduler(); defaultScheduler.shutdown(true); } catch (Exception e) { e.printStackTrace(); } } }
=======================
配置前,要手动再停止一次,才能 Disconnected from server
================
配置后,干净利落结束了