Service not injecting properly into quartz job class With quartz scheduler plugin (v1.0.1) for grails 2.3.6 -
i've implemented own quartz job classes take in service method . however, service doesn't seem injecting job class nullpointer exception when accessing service.
how services injected during trigger of job .
any suggestion on how invoke method in service job class
update 1 : added job code , log messages
import org.quartz.job; import org.quartz.jobexecutioncontext; import org.quartz.jobexecutionexception; import org.quartz.jobdatamap; import com.unitrac.app.reportcentre.report.reportservice; // logging import org.apache.commons.logging.logfactory; class reportjob implements job { def reportservice; def grailsapplication; // logging private static final log = logfactory.getlog(this); void execute(jobexecutioncontext context) throws jobexecutionexception { // execute job jobdatamap jobmapdata = context.getmergedjobdatamap(); try { log.debug("in report job - executing job @ " + new date() + " " + context.gettrigger().getname()); string groupname = context.gettrigger().getjobkey().getname(); log.debug("group name : " + groupname); reportservice.invokemethod(); } catch( exception e ) { log.error("exception: $e"); } } }
| |
server running. browse http://localhost:8080/reportcentre 2014-04-22 14:50:00,087 [unitracjobscheduler_worker-1] debug reportcentre.reportjob - in report job - executing job @ tue apr 22 14:50:00 cat 2014 cctrigger 2014-04-22 14:50:00,104 [unitracjobscheduler_worker-1] debug reportcentre.reportjob - group name : devgroup 2014-04-22 14:50:00,106 [unitracjobscheduler_worker-1] error reportcentre.reportjob - exception: java.lang.nullpointerexception: cannot invoke method invokemethod() on null object
make sure job class in in grails-app/jobs
, try removing implements job
.
Comments
Post a Comment