Injecting a Transactional Grails Service into a Quartz Plugin Job gives BeanCreationExecption -



Injecting a Transactional Grails Service into a Quartz Plugin Job gives BeanCreationExecption -

grails version: 2.3.5 quartz plugin version: 1.0.2

i creating internal grails plugin. plugin has dependency on grails quartz plugin.

i have grails service: orchestratorjobexecutorservice

public class orchestratorjobexecutorservice { def grailsapplication def jobmanagerservice public void execute() { //do bunch of stuff using here //using grailsapplication find bunch of artifacts i've created in plugin //using jobmanagerservice check if trigger exists, re/schedule job needed } }

i have quartz job: orchestratorjob

public class orchestratorjob { def orchestratorjobexecutorservice static triggers = {cron cronexpression: "0 0 15 * * ? *"} def grouping = "orchestrator" public execute(jobexecutioncontext jobexecutioncontext) throws jobexecutionexception { orchestratorjobexecutorservice.execute() } }

when job executes org.springframework.beans.factory.beancreationexception

....core.errorlogger error occured instantiating job executed. job= 'myplugin.com.bgc.orchestratorjob' org.quartz.schedulerexception: job instantiation failed [see nested exception: org.springframework.beans.factory.beancreationexception: error creating bean name 'com.bgc.tamiorchestratorjob': initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mypluginorchestratorjobexecutorservice': cannot resolve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'transactionmanager' defined] @ org.quartz.core.jobrunshell.initialize(jobrunshell.java:127) @ org.quartz.core.quartzschedulerthread.run(quartzschedulerthread.java:375) caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'com.bgc.orchestratorjob': initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mypluginorchestratorjobexecutorservice': cannot resolve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'transactionmanager' defined @ grails.plugins.quartz.grailsjobfactory.createjobinstance(grailsjobfactory.java:48) ... 2 more caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'mypluginorchestratorjobexecutorservice': cannot resolve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'transactionmanager' defined ... 3 more caused by: org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'transactionmanager' defined ... 3 more

i don't have much special in myplugingrailsplugin.groovy file. few lines i've changed besides basic plugin version/description/documentation lines are:

def loadafter = ['controllers','services','spring-security-core','quartz','myotherplugin'] def pluginexcludes = [/*a bunch of folders files utilize test , run plugin*/]

i don't have else defined in of dowith* closures or on* closures

if add together static transactional = false orchestratorjobexecutorservice, error goes away. have several jobs , services , i've had go through entire plugin , set every service non-transactional. don't sense comfortable that, moving away transactional service scares me. in main application plugin going used, there going lot of database interaction in plugin artefacts i've created.

anyone know how can maintain services transactional , still have them injected?

=====edit 10/20/2014=====

added hibernate 3 dependency:

runtime ":hibernate:3.6.10.17"

new error:

context.grailscontextloader error initializing application: org.springframework.beans.factory.annotation.injectionmetadata.needsrefresh(lorg/springframework/beans/factory/annotation/injectionmetadata;ljava/lang/class;)z java.lang.nosuchmethoderror: org.springframework.beans.factory.annotation.injectionmetadata.needsrefresh(lorg/springframework/beans/factory/annotation/injectionmetadata;ljava/lang/class;)z @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:303) @ java.util.concurrent.futuretask.run(futuretask.java:138) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:895) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:918) @ java.lang.thread.run(thread.java:662) error | forked grails vm exited error

running clean-all , refresh-dependencies several times didn't seem resolve error (that's standard procedure when errors can't create sense of).

buildconfig.groovy

grails.project.class.dir = "target/classes" grails.project.test.class.dir = "target/test-classes" grails.project.test.reports.dir = "target/test-reports" grails.release.scm.enabled = false grails.project.repos.snapshotartifactory.url = "https://<mysnapshotrepourl>" grails.project.repos.releaseartifactory.url = "http://<myreleaserepourl>" grails.project.repos.snapshotartifactory.username = "<topsecretusername>" grails.project.repos.snapshotartifactory.password = '<topsecretpassword>' grails.project.fork.test = false grails.project.fork = [ run: [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256, forkreserve:false], war: [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256, forkreserve:false], console: [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256] ] grails.project.dependency.resolver = "maven" grails.project.dependency.resolution = { inherits("global") {} log "warn" repositories { grailscentral() mavencentral() mavenrepo ("https://<mysnapshotrepourl>"){updatepolicy "always"} } dependencies { compile("org.hamcrest:hamcrest-all:1.3") } plugins { build ":release:3.0.1" build (":tomcat:7.0.50"){export=false} compile "com.<mycompany>.plugins:myotherplugin:0.1-snapshot" compile ":quartz:1.0.2" runtime ":hibernate:3.6.10.17" } }

do have hibernate plugin installed, or gorm plugin? think wouldn't have gotten far if not, that's transactionmanager bean comes from.

grails grails-plugin

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -