0

我在我的类 SchedulerJob 的 web 应用程序中使用石英调度我正在从数据库中获取数据并根据某些条件设置一些字段但我收到以下错误

org.quartz.SchedulerException: JobStore class 'org.quartz.simpl.RAMJobStore' props could not be configured. [See nested exception: java.lang.NoSuchMethodException: No setter for  property 'driverDelegateClass,']

我有quartz.properties 文件,我在其中定义了RAM JOB,例如

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
org.quartz.jobStore.tablePrefix, 
org.quartz.jobStore.driverDelegateClass, 
org.quartz.jobStore.dataSource
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

我的课是

public class QuartzSchedulerListener implements ServletContextListener {

public void contextDestroyed(ServletContextEvent arg0) {
    //
}

public void contextInitialized(ServletContextEvent arg0) {

    JobDetail job = JobBuilder.newJob(SchedulerJob.class)
        .withIdentity("anyJobName", "group1").build();

    try {

        Trigger trigger = TriggerBuilder
          .newTrigger()
          .withIdentity("anyTriggerName", "group1")
          .withSchedule(
             CronScheduleBuilder.cronSchedule("0/10 * * * * ?"))
          .build();

        Scheduler scheduler = new StdSchedulerFactory().getScheduler();
        scheduler.start();
        scheduler.scheduleJob(job, trigger);

    } catch (SchedulerException e) {
        e.printStackTrace();
    }

}

}

每 10 秒发射一次

和一个 SchedulerJob 做这样的工作

公共类 SchedulerJob 实现 Job { private static final Logger LOGGER = LoggerFactory.getLogger(SchedulerJob.class);

@EJB
private Iinterface service;


public void execute(JobExecutionContext context)
    throws JobExecutionException {

    // fetch list from DB
    List<SampleClass> list= new ArrayList<SampleClass>();
    try {

        list= service.getData();
        LOGGER.info("after action cron");
    } catch (Exception e) {
        LOGGER.info("exception action cron");
        e.printStackTrace();
    } 

    DO some operation and update on this list


    System.out.println("Struts 2.3.4 + Quartz 2.1.5");

}

}

这是完整的堆栈跟踪

[#|2013-05-20T23:36:32.132+0530|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=10;_ThreadName=Thread-2;|org.quartz.SchedulerException: JobStore class 'org.quartz.simpl.RAMJobStore' props could not be configured. [See nested exception: java.lang.NoSuchMethodException: No setter for property 'driverDelegateClass,']
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:874)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1502)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4750)
at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:550)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5366)
at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:375)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:219)
at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:131)
at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:253)
at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:145)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:136)
at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)
at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:69)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)

原因:java.lang.NoSuchMethodException:在 org.quartz.impl.StdSchedulerFactory.setBeanProps(StdSchedulerFactory.java:1390) 处 org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:872) 中没有属性“driverDelegateClass”的设置器) ... 37 更多 |#]

请建议我在这里做错了什么

4

1 回答 1

1

RamJobStore 没有属性 org.quartz.jobStore.driverDelegateClass。此外,您的属性文件包含您正在使用的作业存储类型的其他不正确属性:

org.quartz.jobStore.tablePrefix、
org.quartz.jobStore.driverDelegateClass、
org.quartz.jobStore.dataSource。

为什么用逗号分隔?您可以将石英作业存储在内存中(通过使用 RamJobStore)或持久存储到 RDBMS(通过使用 JobStoreTx)。所以首先要自己决定你需要什么样的存储空间。石英网站上提供了每个案例的示例。

于 2013-05-20T19:12:36.560 回答