我正在使用带有quartz的servicemix和默认的RAMJobStore。因为我们有集群,所以我们想使用hazelcast,我们已经完成了HazelcastJobStore。我改变了这个属性
org.quartz.jobStore.class =
将我的自定义jobstore放在servicemix中,当我这样做时:
scheduler = schedulerFactory.getScheduler()
我收到了这个错误
Caused by: org.quartz.SchedulerException: JobStore class 'com.sncf.canaltrain.transverse.jobStore.hazelcast.HazelCastJobStore' could not be instantiated. [See nested exception: java.lang.ClassNotFoundException: com.sncf.canaltrain.transverse.jobStore.hazelcast.HazelCastJobStore]
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:852)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1525)
at com.sncf.canaltrain.transverse.scheduler.SchedulerService.startScheduler(SchedulerService.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_71]
at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_71]
at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)[18:org.apache.aries.blueprint.core:1.4.3]
at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)[18:org.apache.aries.blueprint.core:1.4.3]
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)[18:org.apache.aries.blueprint.core:1.4.3]
... 54 more
Caused by: java.lang.ClassNotFoundException: com.sncf.canaltrain.transverse.jobStore.hazelcast.HazelCastJobStore
我发现尝试实现作业存储的类是:
String classLoadHelperClass = this.cfg.getStringProperty("org.quartz.scheduler.classLoadHelper.class", "org.quartz.simpl.CascadingClassLoadHelper");
这是默认值,但我认为在servicmix中它不正确...
确实存在我可以做的事情来解决这个类路径错误?或者我需要实现自己的classLoadHelper并尝试使用osgi classthpath来查找我的类?
谢谢!
答案 0 :(得分:0)
最后我找到了解决方案,
我使用fragment来添加我的customJobStore和片段,主机(quartz)正确找到我的jobstore并且一切正常!
如果可以提供帮助;)