Java學習-4 Quartz線程無法隨Tomcat停止的處理(Exception in thread "DefaultQuartzScheduler_Worker-8" java.lang.NoClassDefFoundError: org/apache/log4j/spi/ThrowableInformation)


 症狀: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

 ================

配置后,干凈利落結束了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM