Я использую Grails 2.2.2 (GGTS - 3.3.0M1) с подключаемым модулем Quartz 1.0-RC7.
Со следующим заданием я получаю сообщение об ошибке, говорящее о том, что создание экземпляра задания не удалось при тестировании с помощью «grails run-app». Я вижу ту же ошибку, если я явно вызываю triggerNow() из контроллера. Ошибка заключается в следующем:
| 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
Я создал задание с помощью команды «grails create-job», которая добавила файл в папку 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)
}
}
}
Я добавил зависимость 'compile ":quartz:1.0-RC7"' в BuildConfig.groovy. Что мне не хватает? Неважно, определена ли у меня «группа», тем не менее я получаю сообщение об ошибке. Я больше не вижу ошибок о том, почему создание bean-компонента возвращает null.