[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
JobDetail is abstract:cannot be instantiated  XML
Forum Index -> Quartz
Author Message
Martinos

journeyman

Joined: 10/16/2010 04:32:47
Messages: 20
Offline

Hello

I've just tried Quartz 2.01 in my Java application and I find that I am receiving messages saying that jobDetail and CronTrigger are abstract and can't be instantiated.

Is this a change from Quartx 1.8.3 which I've been using up until now.

This is the type of code I'm using in a Listener which is started from web.xml when the context is intialised. I store the job details in a database table.

Code:
 try {
             scheduler = StdSchedulerFactory.getDefaultScheduler();
         }
         catch(Exception ex) {
             logger.error("Error getting scheduler at " + sqlDateTimeNow + "\n", ex);
         }
 
         // ******************************************************************************************
         // ** SUBMIT JOBS.                                                                         **
         // ******************************************************************************************
 
         // Poll RSS_Feeds for new data to update Datasets.
         try {
             sj = Scheduler_Job_DB.get(1);            
             jd = new JobDetail(sj.getJobName(), scheduler.DEFAULT_GROUP, Poll_RSS_Feeds_ToUpdateDatasets_ScheduleJob.class); // Requires class name to be hardcoded, will not allow casting. Why?
             ct = new CronTrigger(sj.getJobQuartzTrigger(), scheduler.DEFAULT_GROUP, "" + sj.getJobQuartzCronExpression().trim() + "");
             scheduler.scheduleJob(jd, ct);
             System.out.println("Job " + sj.getJobName() + " submitted.");
         }
         catch(Exception ex){
             logger.error("Error submitting job " + sj.getJobName() + " at " + sqlDateTimeNow + "\n", ex);
         }
 


Also, when the context is destroyed, I tend to unschedule the jobs, as so:

Code:
 Scheduler_Job sj = null;
         SQLDateTime sqlDateTimeNow = SQLDateTime.getSQLDateTimeNow();
 
         // ******************************************************************************************
         // ** UNSUBMIT JOBS.                                                                       **
         // ******************************************************************************************
 
         // Poll RSS_Feeds for new data to update Datasets.
         try {
             sj = Scheduler_Job_DB.get(1);
             scheduler.unscheduleJob(sj.getJobName(), scheduler.DEFAULT_GROUP);          
             System.out.println("Job " + sj.getJobName() + " unsubmitted.");
         }
         catch(Exception ex){
             logger.error("Error unsubmitting job " + sj.getJobName() + " at " + sqlDateTimeNow + "\n", ex);
         }
 


But I find now that scheduler.unscheduleJob can't be applied to the given types.

Can anyone advise?

Thanks

Martin O'Shea.
alexsnaps

consul

Joined: 06/19/2009 09:06:00
Messages: 484
Offline

Quartz 2.0 has some breaking changes API wise as you discovered.
You should be able to upgrade easily though, with only little changes.
There is a migration guide explaining all the changes coming with 2.0 and the necessary steps to address these:
http://www.quartz-scheduler.org/docs/2.0/migrationGuide.html
hth!

Alex Snaps (Terracotta engineer)
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team