可以设置“集群” Quartz 设置的属性会导致单台机器出现问题吗?
我们配置了一堆quartz作业在集群环境中运行,并且在真实集群(两台WAS机器)上一切似乎都运行良好。
在DEV环境中我们仍然使用
org.quartz.jobStore.isClustered = true
虽然我们只使用单机。但我们经常但并不总是遇到以下异常:
org.quartz.JobPersistenceException:
Couldn't store trigger 'DEFAULT.MT_6uclr3emepk6p' for '<group>.<name>'
job:The job (<group>.<name>) referenced by the trigger does not exist.
我们将 DEV 环境的设置更改为
org.quartz.jobStore.isClustered = false
这似乎使问题消失了。
所以问题是:
- 当您实际上没有使用集群时,设置 org.quartz.jobStore.isClustered = true 是否有问题,
- 如果是的话,为什么?
- 如果不是,最初问题的原因可能是什么?
更新:澄清错误何时发生:
这是设置作业的代码片段。
JobKey JOBKEY = new JobKey("Name", "group");
newTrigger().withIdentity("TriggerName", "group").forJob(
JOBKEY).build();
JobDetail job = newJob(NameJob.class).withIdentity(
JOBKEY)
.storeDurably().build();
scheduler.addJob(job, false);
该片段应该触发作业执行
scheduler.triggerJob(JOBKEY);
We have a bunch of quartz jobs configured for running in a clustered environment and everything seems to work fine on the real cluster (two WAS machines).
In the DEV environment we still used
org.quartz.jobStore.isClustered = true
although we only use a single machine. But we get often but not always the following exception:
org.quartz.JobPersistenceException:
Couldn't store trigger 'DEFAULT.MT_6uclr3emepk6p' for '<group>.<name>'
job:The job (<group>.<name>) referenced by the trigger does not exist.
We changed the setup for the DEV environment to
org.quartz.jobStore.isClustered = false
This seemed to make the problem go away.
So the questions are:
- Is it a problem to set
org.quartz.jobStore.isClustered = true
when you aren't actually using a cluster - if so why?
- if not what might be the reason for the original problem?
UPDATE: Clarification on when the error occurs:
This is the snippet that sets up the job.
JobKey JOBKEY = new JobKey("Name", "group");
newTrigger().withIdentity("TriggerName", "group").forJob(
JOBKEY).build();
JobDetail job = newJob(NameJob.class).withIdentity(
JOBKEY)
.storeDurably().build();
scheduler.addJob(job, false);
This snippet is supposed to trigger a job execution
scheduler.triggerJob(JOBKEY);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一条红鲱鱼。 isClustered=true 对于一个节点就可以了(尽管没有必要)。
我敢打赌,您会遇到由多个开发人员使用同一数据库同时进行测试/构建而引起的问题。
That's a red herring. isClustered=true with one node is just fine (though unnecessary).
I'll bet you were running into problems caused by multiple developers using the same database, while doing their tests/builds concurrently.