我已经在这里搜索了所有与Quartz Scheduler相关的问题,但没有发现其他人遇到我所遇到的问题。这个问题不是关于时间表未正确运行或作业未被触发的问题,而这正是我最常发现的问题。当我尝试实例化StdSchedulerFactory对象时,似乎进入了挂起状态。
if(_logger.isInfoEnabled())
_logger.info("made it here 01");
SchedulerFactory schedFact = new StdSchedulerFactory();
if(_logger.isInfoEnabled())
_logger.info("made it here 02");
_sched = schedFact.getScheduler();
此代码块位于同步块内部,该块还检查_sched(已声明为org.quartz.Scheduler)当前是否正在运行。如果我们输入同步块并发现Scheduler当前正在运行,则将其关闭。
代码似乎挂在StdSchedulerFactor()对象的实际实例上。 “在这里制作01”会打印出来,但是“在这里制作02”永远不会打印出来。
此代码在我的本地计算机和实验室环境下都可以正常工作。部署到客户端服务器后,它将失败。
笔记夫妇
在我的本地环境中,我在catalina.log文件中打印了以下内容。
[2018-11-11 07:23:07,456] [INFO] [QuartzScheduler.java:694] [Scheduler
DefaultQuartzScheduler_$_NON_CLUSTERED shutting down.]
[2018-11-11 07:23:07,457] [INFO] [QuartzScheduler.java:613] [Scheduler
DefaultQuartzScheduler_$_NON_CLUSTERED paused.]
[2018-11-11 07:23:07,457] [INFO] [QuartzScheduler.java:771] [Scheduler
DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete.]
[2018-11-11 07:23:07,459] [INFO] [StdSchedulerFactory.java:1184] [Using
default implementation for ThreadExecutor]
[2018-11-11 07:23:07,459] [INFO] [SimpleThreadPool.java:268] [Job execution
threads will use class loader of thread: pool-6-thread-1]
[2018-11-11 07:23:07,462] [INFO] [SchedulerSignalerImpl.java:61]
[Initialized Scheduler Signaller of type: class
org.quartz.core.SchedulerSignalerImpl]
[2018-11-11 07:23:07,462] [INFO] [QuartzScheduler.java:240] [Quartz
Scheduler v.2.2.1 created.]
[2018-11-11 07:23:07,463] [INFO] [RAMJobStore.java:155] [RAMJobStore
initialized.]
[2018-11-11 07:23:07,463] [INFO] [QuartzScheduler.java:305] [Scheduler meta-
data: Quartz Scheduler (v2.2.1) 'DefaultQuartzScheduler' with instanceId
'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support
persistence. and is not clustered.
]
[2018-11-11 07:23:07,463] [INFO] [StdSchedulerFactory.java:1339] [Quartz
scheduler 'DefaultQuartzScheduler' initialized from default resource file in
Quartz package: 'quartz.properties']
[2018-11-11 07:23:07,463] [INFO] [StdSchedulerFactory.java:1343] [Quartz
scheduler version: 2.2.1]
同样,该打印输出来自正在运行的本地环境。但是,在客户端环境中,永远不会打印出来。也不打印任何错误。
如果需要,我可以包含更多的整体代码,但是,由于该代码可在我尝试过的所有其他环境下运行,因此我想知道是否需要寻找某些环境设置?< / p>