|
Hi to all,
I just installed the quartz plugin (version 0.4.1). Then I created my job-class using "grails create-job" and modified it for printing out a little message as test. This is it: class DoiMassUpdateJob { static triggers = { cron cronExpression: "0 13 * ? * *" // test } def execute() { log.info('Starting mass upgrade...'); println('Starting mass upgrade...'); log.info('... mass upgrade finished.'); println('... mass upgrade finished.'); } } Then I created a war file (grails dev war) and deployed under tomcat (INFO: Starting Servlet Engine: Apache Tomcat/6.0.16) on another machine. Now, I'm expecting that every 13 min. I should see the message Starting mass upgrade... ... mass upgrade finished. appearing in the catalina.out. But it is not so... Do I miss something? I'm using grails 1.1.1 Thanx for any help. Francesco |
|
Hi Francesco,
that cron will run at 13 minutes past the hour, every hour. Not every thirteen minutes. You need something like 0 */13 * * ? (I can't remember the exact syntax...) cheers Lee 2009/7/9 Juza1 <[hidden email]>
|
|
Hi Lee, you are right.
I changed it to 0 */13 * * ? but still no job started... ![]() Ciao Francesco
|
|
Check the Quartz documentation for the syntax, that was only a guess :)
If you really want to be sure try all stars, if it doens't run then, something is definitely wrong! Can you see any logging from the Quartz scheduler saying it's starting? cheers Lee 2009/7/9 Juza1 <[hidden email]>
|
|
This post was updated on .
Hi Lee,
all "*" is not possible... Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.plugins.quartz.DefaultGrailsTaskClass ... 25 more Caused by: java.lang.reflect.InvocationTargetException ... 25 more Caused by: java.lang.Exception: Cron expression '* * * * * *' in the job class DoiMassUpdateJob is not a valid cron expression So I tried with def cronExpression = "* 1 * * * ?" (should be every minute) but still nothing... Where should be the logging from the Quartz scheduler? In my config.groovy I defined debug scheduler:"grails.app.task" but there is no output there... Thanx and ciao Francesco
|
|
Hi,
I think there are normally some INFO messages as the web application starts. Does the job run if you use a simple trigger instead of a cron one? This should make it run every 5 seconds: "0/5 * * * * ?" If you still get nothing then I'm not sure what's going on, hopefully Sergey or Marcel will see this mail and have some further suggestions. cheers Lee 2009/7/10 Juza1 <[hidden email]>
|
|
Hi Lee,
I tried with ... def startDelay = 30000 def timeout = 10000 def group = "MyGroup" def execute() { log.info('Starting mass upgrade...'); println('Starting mass upgrade...'); log.info('... mass upgrade finished.'); println('... mass upgrade finished.'); } and with static triggers = { simpleTrigger startDelay:10000, timeout: 30000, repeatCount: 10 } def execute() { log.info('Starting mass upgrade...'); println('Starting mass upgrade...'); log.info('... mass upgrade finished.'); println('... mass upgrade finished.'); } but without success... ![]()
|
|
Hi,
well, I'm out of suggestions then - sorry! Attach a debugger and debug the QuartzGrailsPlugin.groovy code to see if it does anything? I've been using 0.4.1-SNAPSHOT and 0.4.1 with both 1.1 and 1.1.1 and it has worked well, so I'm not sure what it is about your setup that is causing problems. cheers Lee 2009/7/13 Juza1 <[hidden email]>
|
|
My thought: something else to try (trivial, but I couldn't see that you have tried this by looking through nabble, apologies if you have already given it a go...)
http://docs.codehaus.org/display/GRAILS/Grails+Quartz+Plugin+0.3.2+Release+Notes "you can define your execute method as {{def execute(context){} }} and have access to Quartz's JobExecutionContext" So try changing the method definition. I found that I had to use a full Java-style method to get things working properly. Thus, I have this job: === import org.quartz.Job import org.quartz.JobExecutionContext // http://www.nabble.com/Quartz-Plugin%3A-Dynamic-Jobs-Scheduling-Implemented-td18643469.html#a18643469 class DynamicallyCreatedJob implements Job { def sessionRequired = false static triggers = {} @Override void execute(JobExecutionContext context) { def output = context.mergedJobDataMap.get('output') synchronized(output) { output << "${context.fireTime}: ${context.mergedJobDataMap.get('message')}" } } } === Is a thing of beauty for me... HTH, BOB > -----Original Message----- > From: Lee Butts [mailto:[hidden email]] > Sent: Tuesday, 14 July 2009 9:02 AM > To: [hidden email] > Subject: Re: [grails-user] Quartz plugin installed, but no job start... > > Hi, > > well, I'm out of suggestions then - sorry! > > Attach a debugger and debug the QuartzGrailsPlugin.groovy code to see > if it does anything? > > I've been using 0.4.1-SNAPSHOT and 0.4.1 with both 1.1 and 1.1.1 and it > has worked well, so I'm not sure what it is about your setup that is > causing problems. > > cheers > > Lee > > > 2009/7/13 Juza1 <[hidden email]> > > > > Hi Lee, > > I tried with > > ... > def startDelay = 30000 > def timeout = 10000 > > def group = "MyGroup" > > > > def execute() > { > log.info('Starting mass upgrade...'); > > println('Starting mass upgrade...'); > > log.info('... mass upgrade finished.'); > println('... mass upgrade finished.'); > } > > > and with > > static triggers = > { > simpleTrigger startDelay:10000, timeout: 30000, > repeatCount: 10 > > } > > > def execute() > { > log.info('Starting mass upgrade...'); > println('Starting mass upgrade...'); > > log.info('... mass upgrade finished.'); > println('... mass upgrade finished.'); > } > > > but without success... :,( > > > > Lee Butts wrote: > > > > Hi, > > > > I think there are normally some INFO messages as the web > application > > starts. > > > > Does the job run if you use a simple trigger instead of a cron > one? > > > > This should make it run every 5 seconds: "0/5 * * * * ?" > > > > If you still get nothing then I'm not sure what's going on, > hopefully > > Sergey > > or Marcel will see this mail and have some further suggestions. > > > > cheers > > > > Lee > > > > > > > -- > View this message in context: http://www.nabble.com/Quartz- > plugin-installed%2C-but-no-job-start...-tp24407064p24457264.html > > Sent from the grails - user mailing list archive at Nabble.com. > > > ----------------------------------------------------------------- > ---- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Another simple question:
If I have my application and add a simple cronjob as that defined in the Quartz plugin documentation class MyJob { def cronExpression = "0 0 6 * * ?" def group = "MyGroup" def execute(){ print "Job run!" } } , than if I start my application in Eclipse (with Vista), should I see the message, right?! (I see no message anyway...) Francesco |
|
Sorry, I mean if I would see the message in the eclipse console...
Francesco
|
|
You are not alone on this issue.
I have tried every combination of: static triggers = {} and using the deprecated methods of configuring a job. I recently upgraded from Grails 1.0.4 to Grails 1.1.1 and I upgraded the Quartz plugin to 0.4.1-SNAPSHOT from 0.3.2. I am attempting to kick-off a simple job that prints something to the console and I am testing that the job runs in development. I have been unsuccessful in getting this to run: class TestThisJob { static triggers = { cron(name:'testThisJob', startDelay: new Long(10000), cronExpression:"0/15 * * * * ?") } def execute() { // execute task println "executed the job" } } I have cleaned the project and re-ran the application and I am getting the following stacktrace: 2009-07-14 15:08:33,357 [main] WARN mortbay.log - Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.plugins.quartz.DefaultGrailsTaskClass: java.lang.Exception: Invalid format at TestThisJob$__clinit__closure1.doCall(TestThisJob.groovy:5) at TestThisJob$__clinit__closure1.doCall(TestThisJob.groovy) at java.security.AccessController.doPrivileged(Native Method) at grails.web.container.EmbeddableServer$start.call(Unknown Source) at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy:145) at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy) at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274) at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:137) at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) at _GrailsRun_groovy.runInline(_GrailsRun_groovy:104) at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy) at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:58) at RunApp$_run_closure1.doCall(RunApp.groovy:33) at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324) at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334) at gant.Gant$_dispatch_closure6.doCall(Gant.groovy) at gant.Gant.withBuildListeners(Gant.groovy:344) at gant.Gant.this$2$withBuildListeners(Gant.groovy) at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) at gant.Gant.dispatch(Gant.groovy:334) at gant.Gant.this$2$dispatch(Gant.groovy) at gant.Gant.invokeMethod(Gant.groovy) at gant.Gant.processTargets(Gant.groovy:495) at gant.Gant.processTargets(Gant.groovy:480) Could there be any left over configurations from the previous version of the Quartz plugin that I am not seeing in my code that weren't cleaned out in the upgrade to quartz-0.4.1-SNAPSHOT? I really want to implement dynamic jobs so I want to stick with this version of the Quartz plugin. -----Original Message----- From: Juza1 <[hidden email]> Reply-to: [hidden email] To: [hidden email] Subject: RE: [grails-user] Quartz plugin installed, but no job start... Date: Tue, 14 Jul 2009 02:24:26 -0700 (PDT)
Sorry, I mean if I would see the message in the eclipse console...
Francesco
Juza1 wrote:
>
> Another simple question:
>
> If I have my application and add a simple cronjob as that defined in the
> Quartz plugin documentation
>
> class MyJob {
> def cronExpression = "0 0 6 * * ?"
>
> def group = "MyGroup"
>
> def execute(){
> print "Job run!"
> }
> }
>
> , than if I start my application in Eclipse (with Vista), should I see the
> message, right?! (I see no message anyway...)
>
> Francesco
>
|
|
Any progress on resolving this problem? I've run into the same issue.
Gene
|
|
I am using Grails 2.0.0.RC3 with the Quartz plugin and I get the following behavior in different environments:
In development: Everything runs great and I see the log messages In production: No execution of any jobs or messages about the plugin loading jobs My logging levels and all Quartz plugin configurations are exactly the same no matter which environment we run in. The only difference is that the production deployment is by WAR file into Tomcat and the development environment is running using grails run-app -https command. Any help would be much appreciated.
Chris Sterling
VP of Engineering www.AgileAdvantage.com Get rid of those Impediment Monkeys at: www.ImpedimentMonkey.com |
|
You've verified that it is set to autostartup right?
quartz { autoStartup = true jdbcStore = false } environments { test { quartz { autoStartup = false } } } --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Yes, mine is
quartz { autoStartup = true jdbcStore = false waitForJobsToCompleteOnShutdown = true }
Chris Sterling
VP of Engineering www.AgileAdvantage.com Get rid of those Impediment Monkeys at: www.ImpedimentMonkey.com |
|
In reply to this post by robelsner
I wanted to add in a bit more information. My class is down in a package underneath grails-app/jobs just as in my other application. Also, I wonder about the Quartz plugin groovy class where it calls on:
"file:./grails-app/jobs/**/*Job.groovy" "file:./plugins/*/grails-app/jobs/**/*Job.groovy" Rather than ${basedir}/... or classpath lookup. I am wondering if in development mode because I am starting it up in the project directory it is finding the *Job.groovy file? And then in the WAR scenario, the deployed WAR does not contain this same path and instead compiles all of the classes into WEB-INF/classes directory thus leading to it not being found? Just a shot in the dark for someone who knows more than I about the plugin and the way it works with classpath and file system lookups?
Chris Sterling
VP of Engineering www.AgileAdvantage.com Get rid of those Impediment Monkeys at: www.ImpedimentMonkey.com |
|
And one more thing, I am able to reproduce this in development environment leading me to believe that my hunch may be correct. I just run the application using run-war -https and I no longer get running Quartz jobs whereas in run-app I do. Now that I can easily reproduce in an environment I can mess around I will probably follow up with a fix.
Chris Sterling
VP of Engineering www.AgileAdvantage.com Get rid of those Impediment Monkeys at: www.ImpedimentMonkey.com |
|
In reply to this post by csterwa
I haven't checked with Grails 2, but in 1.3.7 it works fine out of a
WAR release which is why I'm asking about environment. Have you tried a WAR file generated for development to see if it works? grails dev war Rob --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
I am using the Quartz plugin on 1.3.7 with no problems, as well. When I used the run-war -https args that was running in the development environment and still I did not get any jobs loading. Should have some information later tonight on this one.
Chris Sterling
VP of Engineering www.AgileAdvantage.com Get rid of those Impediment Monkeys at: www.ImpedimentMonkey.com |
| Powered by Nabble | Edit this page |
