I am using Grails 2.2.2 (GGTS - 3.3.0M1) with Quartz plugin 1.0-RC7.
With the following job, I get an error saying that the job instantiation failed when testing with 'grails run-app'. I see the same error if I explicitly call triggerNow() from a controller. The error is as follows:
| Error 2013-05-07 10:50:20,260 [quartzScheduler_QuartzSchedulerThread] ERROR core.ErrorLogger - An error occured instantiating job to be executed. job= 'GRAILS_JOBS.mypkg.auth.OAuthJob'
Message: Job instantiation failed
Line | Method
->> 134 | initialize in org.quartz.core.JobRunShell
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
^ 387 | run in org.quartz.core.QuartzSchedulerThread
Caused by BeanCreationException: Error creating bean with name 'mypkg.auth.OAuthJob': factory-bean 'mypkg.auth.OAuthJobClass' returned null
I created the job with the 'grails create-job' command which added a file under grails-app/jobs/mypkg/auth/OAuthJob.groovy
package mypkg.auth
import org.quartz.JobExecutionContext
import org.quartz.JobExecutionException
//import org.grails.plugins.quartz.JobManagerService
class OAuthJob {
def AuthService
def grailsApplication
static triggers = {
// Execute job once in 11 hours (42600 seconds)
simple name = "OAuthTokenTrigger", repeatInterval: 426000000l
}
def group = "OAuthJobGroup"
def execute(JobExecutionContext context) throws JobExecutionException {
try {
log.debug("OAuthJob has been invoked, now requesting token")
// Call AuthService get token
AuthService.getToken(context.mergedJobDataMap)
} catch (Throwable e) {
throw new JobExecutionException(e.getMessage(), e)
}
}
}
I have added a 'compile ":quartz:1.0-RC7"' dependency to BuildConfig.groovy. What am I missing? It doesn't matter if I have the 'group' defined, I get the error nevertheless. I do not see any more errors about why bean creation returns null.