NXQL Document.Query

I have a problem with a simple NXQL query in Studio launched using quartz :

SELECT * FROM Document WHERE reunion:rappel > @{CurrentDate.days(-1)} AND reunion:rappel < @{CurrentDate.days(1)}

it generates the following text in an Info Message :

SELECT * FROM Document WHERE reunion:rappel > TIMESTAMP '2012-09-09 11:12:39.984' AND reunion:rappel < TIMESTAMP '2012-09-10 11:12:39.984'

but does not work with my operation chain :

2012-09-10 11:11:20,032 ERROR [org.nuxeo.ecm.automation.core.events.OperationEventListener] Failed to handle event cron_alarm_reunion using chain: cron_alarm_reunion_op
org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Document.Query
        at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:140)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:114)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:117)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:85)
        at org.nuxeo.ecm.automation.core.events.EventHandlerRegistry.handleEvent(EventHandlerRegistry.java:198)
        at org.nuxeo.ecm.automation.core.events.OperationEventListener.handleEvent(OperationEventListener.java:33)
        at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:195)
        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:102)
        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:59)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
Caused by: java.lang.NullPointerException
        at org.nuxeo.ecm.automation.core.operations.document.Query.run(Query.java:43)
        at sun.reflect.GeneratedMethodAccessor221.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:117)
        at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:132)
        ... 12 more

Any idea ?

0 votes

1 answers

1921 views

ANSWER



Although my scheduler included the Administrator user

<schedule id="cron_alarm_reunion">
  <username>Administrator</username>
  <eventId>cron_alarm_reunion</eventId>
  <eventCategory>default</eventCategory>
  <!-- Toutes les 5 minutes -->
  <cronExpression>0 */15 * * * ?</cronExpression>
</schedule>

I had to include a “Login As” operation before querying the DB

1 votes



If that solves it for you then please mark the question as answered.
09/10/2012

it does, but it seems i can't mark my own answers as accepted
09/11/2012

I did it for you only :) Normally you must have enough points to mark now your own answers as accepted. If not you need a bit more karma points…
09/11/2012

I had the exact same problem, and it solve it too.
07/08/2014