0

我正在使用 Bamboo 构建、测试和部署提交到服务器。但是,每隔一段时间,我就会在 Tomcat 端部署失败。Bamboo 不知道发生了这种情况,因此当应用程序无法正常启动时,我必须运行手动构建。

据我所知,这是由于运行 Quartz 任务所致。有没有办法安全地部署 WAR 但要等到所有工作都完成?在部署之前先制定计划是否更好?

我已经提取了我的 Catalina 日志以突出显示该问题:

Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-3] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-4] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-5] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-6] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-8] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-10] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [Thread-212] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:15 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/emdb]
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [....webapps\emdb\WEB-INF\lib] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [....webapps\emdb\WEB-INF] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [....webapps\emdb] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar delete
SEVERE: [....webapps\emdb] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:17 PM org.apache.catalina.startup.HostConfig deployWAR
4

1 回答 1

1

没错,Quartz 调度程序不会停止为运行作业(工作线程池)而创建的线程。您需要QuartzScheduler.shutdown(boolean)在应用程序关闭时调用方法。我很惊讶 Grails Quartz 插件不适合你。

发生这种情况还有其他原因。您可能有一些正在运行的作业并且 Quartz 挂起等待它们完成(即使调用了正确的关闭)。Tomcat不耐烦,在中间杀死了整个事情。检查(未编码?org.quartz.scheduler.interruptJobsOnShutdownorg.quartz.scheduler.interruptJobsOnShutdownWithWait选项。

请注意,这ShutdownHookPlugin对您没有帮助,因为您没有关闭整个 JVM,而只是取消部署一个应用程序。

错误消息也Thread-212列为原因之一。这很可能是您的自定义线程(总是命名线程!),它也必须被中断。

也可以看看

于 2012-09-23T08:42:38.720 回答