Java Quartz教程无法正常工作

时间:2014-02-13 03:11:07

标签: java quartz-scheduler

请原谅我是一名Java新手 - 我正在尝试使用Quartz,但我很难掌握基本教程:

import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.impl.StdSchedulerFactory;
import static org.quartz.JobBuilder.*;
import static org.quartz.TriggerBuilder.*;
import static org.quartz.SimpleScheduleBuilder.*;
public class QuartzTest {
    public static void main(String[] args) {
        try {
            // Grab the Scheduler instance from the Factory
            Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
            // and start it off
            scheduler.start();
            scheduler.shutdown();
        } catch (SchedulerException se) {
            se.printStackTrace();
        }
    }
}

似乎编译正常,但在运行时,我收到以下错误:

Exception in thread "main" java.lang.VerifyError: verification failed at PC 1134 in org.quartz.impl.StdSchedulerFactory:instantiate(()Lorg.quartz.Scheduler;): String, int, or float constant expected
   at _Jv_BytecodeVerifier.verify_fail(byte, int) (/usr/lib64/libgcj.so.5.0.0)
   at _Jv_BytecodeVerifier.verify_instructions_0() (/usr/lib64/libgcj.so.5.0.0)
   at _Jv_VerifyMethod(_Jv_InterpMethod) (/usr/lib64/libgcj.so.5.0.0)
   at _Jv_PrepareClass(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
   at _Jv_WaitForState(java.lang.Class, int) (/usr/lib64/libgcj.so.5.0.0)
   at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
   at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
   at java.lang.Class.initializeClass() (/usr/lib64/libgcj.so.5.0.0)
   at _Jv_ResolvePoolEntry(java.lang.Class, int) (/usr/lib64/libgcj.so.5.0.0)
   at QuartzTest.main(java.lang.String[]) (Unknown Source)

我不相信quartz.properties文件是一个问题(doc似乎表明它不需要这个基本的东西),但我还是有它可用,基本选项:

org.quartz.scheduler.instanceName = MyScheduler
org.quartz.threadPool.threadCount = 3
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

类路径上的jar包括:

libgcj-4.1.0.jar
quartz-2.2.1.jar
c3p0-0.9.1.1.jar
log4j-1.2.16.jar
quartz-jobs-2.2.1.jar
slf4j-api-1.6.6.jar
slf4j-log4j12-1.6.6.jar

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您需要提供工作类和触发器才能运行。这可能有所帮助。 http://quartz-scheduler.org/documentation/quartz-2.1.x/examples/Example1