Я пытаюсь прочитать пакет сообщений в задании (Grails 2.0, Quartz-0.4.2):
class Job1Job {
def timeout = 5000l // execute job once in 5 seconds
def grailsApplication
def execute() {
def ctx = grailsApplication.mainContext
def bean = ctx.getBean('org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib')
println bean.message(code:'default.home.label')
}
}
И получите ошибку:
Error 2011-12-28 14:30:14,021 [quartzScheduler_Worker-5] ERROR listeners.ExceptionPrinterJobListener - Exception occured in job: GRAILS_JOBS.testappcontext.Job1Job
Message: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
Код отлично работает в контроллере и сервисе. Что я делаю не так?
Я подозреваю, что этот код отлично работает в Grails 1.3.7