I noticed that also in 2.1, but as I didn't have time to investigate I thought it was from my side ...
2010/2/26 Rieken, Joshua <[email protected]> > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Sergiu Dumitriu > > Sent: Friday, February 26, 2010 10:36 AM > > To: XWiki Users > > Subject: Re: [xwiki-users] Scheduler not executing job > > correctly (or at all) > > > > On 02/26/2010 05:20 PM, Rieken, Joshua wrote: > > > > > > > > >> -----Original Message----- > > >> From: [email protected] > > >> [mailto:[email protected]] On Behalf Of Thomas Mortagne > > >> Sent: Friday, February 26, 2010 10:05 AM > > >> To: XWiki Users > > >> Subject: Re: [xwiki-users] Scheduler not executing job > > correctly (or > > >> at all) > > >> > > >> Could not say for sure but at least i can see some examples using > > >> context and xwiki bindings. See > > >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/GroovyNotifi > > >> cationTutorial > > > > > > I think there may be a bug in 2.2 then. I created a new job > > with the following script: > > > > > > def eventLog = xwiki.getDocument("CodeTest.TestEventLog") > > > eventLog.setContent("context class: " + context.class + "\n") > > > eventLog.setContent("xwiki class: " + xwiki.class + "\n") > > > eventLog.save() > > > > > > > > > > > > The output in CodeTest.TestEventLog: > > > > > > xwiki class: class com.xpn.xwiki.api.XWiki > > > > > > > > > The context variable is nowhere to be found. > > > > Try xcontext. > > That doesn't work either. > > > > > > I'll be glad to create a JIRA issue if this indeed is a problem. > > > > > > -Joshua > > > > > >> > > >> On Fri, Feb 26, 2010 at 16:56, Rieken, Joshua > > >> <[email protected]> wrote: > > >>> Thanks for the responses. > > >>> > > >>> After upgrading to 2.2 (I think my main problem was a > > >> combination of 2.1 .war and 2.0 .xar) I got the scheduler to run a > > >> job, but it seems that Groovy jobs don't have access to > > the xcontext > > >> variable. Also, context.class returns null, so is there any way to > > >> get the context within a job script? > > >>> > > >>> -Joshua > > >>> > > >>>> -----Original Message----- > > >>>> From: [email protected] > > >>>> [mailto:[email protected]] On Behalf Of Thomas Mortagne > > >>>> Sent: Wednesday, February 24, 2010 5:05 PM > > >>>> To: XWiki Users > > >>>> Subject: Re: [xwiki-users] Scheduler not executing job > > >> correctly (or > > >>>> at all) > > >>>> > > >>>> On Wed, Feb 24, 2010 at 22:00, Caleb James DeLisle > > >>>> <[email protected]> wrote: > > >>>>> I don't know much about the scheduler but I know that > > >> your script > > >>>>> should be inclosed in {{groovy}} and {{/groovy}} macro > > >>>> tags, it should > > >>>>> be saved in syntax 2.0, The user who saves the script must have > > >>>>> programming rights for it to execute and eventLog.save() > > >>>> may not work > > >>>>> if the scheduler doesn't have edit right on the eventLog > > >> page. Try > > >>>>> eventLog.saveWithProgrammingRights() to override that possible > > >>>>> problem. > > >>>> > > >>>> No actually scheduler is older than xwiki/2.0 syntax and in a > > >>>> scheduler object you put pure groovy code without > > {{groovy}} macro. > > >>>> > > >>>>> > > >>>>> > > >>>>> Caleb James DeLisle > > >>>>> > > >>>>> > > >>>>> > > >>>>> Rieken, Joshua wrote: > > >>>>>> > > >>>>>>> -----Original Message----- > > >>>>>>> From: [email protected] > > >>>>>>> [mailto:[email protected]] On Behalf Of Thomas Mortagne > > >>>>>>> Sent: Wednesday, February 24, 2010 2:24 PM > > >>>>>>> To: XWiki Users > > >>>>>>> Subject: Re: [xwiki-users] Scheduler not executing job > > >>>> correctly (or > > >>>>>>> at all) > > >>>>>>> > > >>>>>>> Hi, > > >>>>>>> > > >>>>>>> I think when you create a job it's not enabled by default. > > >>>>>>> You have to "schedule" on > > >>>> http://host/xwiki/bin/view/Scheduler/ UI. > > >>>>>> > > >>>>>> I scheduled it, but it didn't run. I also tried triggering > > >>>> it manually, but that didn't work either. > > >>>>>> > > >>>>>> -Joshua > > >>>>>> > > >>>>>>> On Wed, Feb 24, 2010 at 20:44, Rieken, Joshua > > >>>>>>> <[email protected]> wrote: > > >>>>>>>> Hello, > > >>>>>>>> > > >>>>>>>> I'm attempting to run the following Groovy script with the > > >>>>>>> Scheduler app: > > >>>>>>>> def eventLog = xwiki.getDocument("CodeTest.TestEventLog") > > >>>>>>>> eventLog.setContent(eventLog.getContent() + "This is > > a test.") > > >>>>>>>> eventLog.save() > > >>>>>>>> > > >>>>>>>> However, this does nothing. I have scheduled the job (which > > >>>>>>> is supposed to run every 5 minutes) and triggered it > > >>>> manually, but > > >>>>>>> it still doesn't do anything. > > >>>>>>>> I also tried surrounding the code with {{groovy}}{{/groovy}}. > > >>>>>>>> > > >>>>>>>> My cron expression is the following: > > >>>>>>>> 0 0/5 * * * ? > > >>>>>>>> > > >>>>>>>> Running on XWiki Enterprise 2.1.1. > > >>>>>>>> > > >>>>>>>> Thanks in advance. > > >>>>>>>> > > >>>>>>>> -Joshua > > > > > > -- > > Sergiu Dumitriu > > http://purl.org/net/sergiu/ > > _______________________________________________ > > users mailing list > > [email protected] > > http://lists.xwiki.org/mailman/listinfo/users > > > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
