Reusable
Reusable

Reputation: 1948

Quartz Scheduler Job run once, then gives an error

Quartz TRIGGERS table

I have a strange behavior from Quartz. The job was able to run after I clear the quartz database tables and tomcat restart. And after a few times of full run, the following error occur. I ran out of clue, anyone had this problem below?

Update:

If I changed the TRIGGER_STATE status from "ERROR" to "WAITING", that job will run again and after a few full cycle, it changed to "ERROR" with the same error stack trace.

[scheduler_QuartzSchedulerThread] 00:07:01,007 ERROR org.quartz.impl.jdbcjobstore.JobStoreSupport.triggerFired(JobStoreSupport.java:2908) - Error retrieving job, setting trigger state to ERROR.
org.quartz.JobPersistenceException: Couldn't retrieve job because a required class was not found: com.mbww.scgid.social.facebook.RunFbPageHourlyJob [See nested exception: java.lang.ClassNotFoundException: com.social.facebook.RunFbPageHourlyJob]
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1416)
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggerFired(JobStoreSupport.java:2903)
        at org.quartz.impl.jdbcjobstore.JobStoreSupport$38.execute(JobStoreSupport.java:2871)
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3788)
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggerFired(JobStoreSupport.java:2865)
        at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:319)
Caused by: java.lang.ClassNotFoundException: com.mbww.scgid.social.facebook.RunFbPageHourlyJob
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329)
        at org.springframework.scheduling.quartz.ResourceLoaderClassLoadHelper.loadClass(ResourceLoaderClassLoadHelper.java:75)
        at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectJobDetail(StdJDBCDelegate.java:894)
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1404)
    ... 5 more

Upvotes: 3

Views: 4546

Answers (2)

Reusable
Reusable

Reputation: 1948

Surprisingly, there are many reasons for this to happen base on Mr Google.

For my case, it is because someone else in the team has deployed another same application (with different name), and this actually cause a confusion to Quartz. When it tries to load the class, it sometimes trying to load the class from the old application, where the class is not there. then the error make sense:

Couldn't retrieve job because a required class was not found: com.mbww.scgid.social.facebook.RunFbPageHourlyJob

After removing the old application from the tomcat, it all runs smooth and well now.

Upvotes: 1

Sezin Karli
Sezin Karli

Reputation: 2525

This is probably a classpath error where you missed to define your classpath. As there's something wrong with your classpath, your app can't find the necessary jar and thus the class it needs.

Upvotes: 1

Related Questions