0

Spring boot 2.0工程 使用了quartz来执行定时任务, 当在IDEA中通过执行Application类来运行的时候 可以正常关闭应用。但是将该应用部署到Tomcat中的时候 关闭Tomcat的时候却报了下面的错误

13-Feb-2018 17:03:30.768 INFO [scheduler_Worker-1] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.core.status.WarnStatus]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

 java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.core.status.WarnStatus]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
    at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1305)

Exception in thread "scheduler_Worker-1" java.lang.NoClassDefFoundError: ch/qos/logback/core/status/WarnStatus
    at ch.qos.logback.classic.LoggerContext.noAppenderDefinedWarning(LoggerContext.java:186)
    at ch.qos.logback.classic.Logger.callAppenders(Logger.java:264)
    at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)
    at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
    at ch.qos.logback.classic.Logger.debug(Logger.java:482)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:612)
    

在SimpleThreadPool 612行中加了断点 但关闭Tomcat的时候并没有进入该断点

getLog().debug("WorkerThread is shut down.");

现在很困惑 感觉无从下手

  • 同样的代码通过Application类启动的话 可以正常关闭 但是通过Tomcat来启动的话 关闭Tomcat的时候 就有了额外的报错信息 是Tomcat做了什么额外的工作吗 还是通过Application类启动的话会先结束scheduler_Worker-1再结束主线程吗 但Tomcat就没有这个顺序
  • 为什么加了断点 也不会进入呢 这样的话 都不知道该怎么调试

1个回答

0

看你的log输出是缺少了jar包,

java.lang.NoClassDefFoundError: ch/qos/logback/core/status/WarnStatus

撰写答案