Quartz待解决问题

package com.ylchou.testQuartz;

import java.util.Date;

import org.quartz.CronTrigger;
import org.quartz.Job;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;

public class QuartzReport implements Job {

        @Override
         public   void  execute(JobExecutionContext cntxt)  throws  JobExecutionException   {  
             System.out.println( "输出:"+cntxt.getJobDetail().getJobDataMap().get("name")+new Date());  
          }  
         public static void  main(String[] args)   {  
             try    {  
                SchedulerFactory schedFact=new StdSchedulerFactory();  
                Scheduler sched=schedFact.getScheduler();  
                sched.start();  
                JobDetail jobDetail=new JobDetail("a","b",QuartzReport.class);  
                jobDetail.getJobDataMap().put("name","lucy");  
                 
                CronTrigger trigger=new  CronTrigger("c","d");  
                trigger.setCronExpression("0/1 * * * * ? " ); // 启动之后立即执行 每一秒继续重复。  
                sched.scheduleJob(jobDetail, trigger);  
                 
            }   catch  (Exception e)   {  
                e.printStackTrace();  
            }
         }

}


报错:

2012-4-28 19:54:54 org.quartz.simpl.SimpleThreadPool initialize
信息: Job execution threads will use class loader of thread: main
2012-4-28 19:54:54 org.quartz.core.SchedulerSignalerImpl
信息: Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2012-4-28 19:54:54 org.quartz.core.QuartzScheduler
信息: Quartz Scheduler v.1.6.1 created.
2012-4-28 19:54:54 org.quartz.simpl.RAMJobStore initialize
信息: RAMJobStore initialized.
2012-4-28 19:54:54 org.quartz.impl.StdSchedulerFactory instantiate
信息: Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
2012-4-28 19:54:54 org.quartz.impl.StdSchedulerFactory instantiate
信息: Quartz scheduler version: 1.6.1
2012-4-28 19:54:54 org.quartz.core.QuartzScheduler start
信息: Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/SetUtils
    at org.quartz.JobDetail.(JobDetail.java:85)
    at com.ylchou.testQuartz.QuartzReport.main(QuartzReport.java:25)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.SetUtils
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 2 more




你可能感兴趣的:(待解决问题)