Search code examples
marklogicapache-nifimarklogic-9

Apache Nifi Marklogic query processor


I am playing with nifi and marklogic processor.. I am trying to use the Query Processor with cts:uri's... following is my cts:uri query

cts:and-query((cts:element-attribute-value-query(fn:QName('http://clarivate.com/schema/wok5.27/public/FullRecord', 'pub_info'),fn:QName('http://clarivate.com/schema/wok5.27/public/FullRecord', 'pubyear'),'2018'), cts:collection-query('dps')))

enter image description here The above query works on query console... but when used in nifi I get the following exception

018-05-18 14:35:30,270 ERROR [pool-27-thread-3] c.m.nifi.processor.QueryMarkLogic QueryMarkLogic[id=01631005-7b1f-199f-65aa-dfa227609659] QueryMarkLogic[id=01631005-7b1f-199f-65aa-dfa227609659] failed to process due to com.marklogic.client.FailedRequestException: Local message: failed to read resource at documents: Bad Request. Server Message: XDMP-RWINVAL0: The value of expression '$0'  is required to be non-zero in rule: set-transaction-timestamp; rolling back session: com.marklogic.client.FailedRequestException: Local message: failed to read resource at documents: Bad Request. Server Message: XDMP-RWINVAL0: The value of expression '$0'  is required to be non-zero in rule: set-transaction-timestamp
com.marklogic.client.FailedRequestException: Local message: failed to read resource at documents: Bad Request. Server Message: XDMP-RWINVAL0: The value of expression '$0'  is required to be non-zero in rule: set-transaction-timestamp
    at com.marklogic.client.impl.OkHttpServices.checkStatus(OkHttpServices.java:4317)
    at com.marklogic.client.impl.OkHttpServices.getIteratedResourceImpl(OkHttpServices.java:3081)
    at com.marklogic.client.impl.OkHttpServices.getBulkDocumentsImpl(OkHttpServices.java:975)
    at com.marklogic.client.impl.OkHttpServices.getBulkDocuments(OkHttpServices.java:860)
    at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:461)
    at com.marklogic.client.impl.GenericDocumentImpl.read(GenericDocumentImpl.java:23)
    at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:439)
    at com.marklogic.client.impl.GenericDocumentImpl.read(GenericDocumentImpl.java:23)
    at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:408)
    at com.marklogic.client.impl.GenericDocumentImpl.read(GenericDocumentImpl.java:23)
    at com.marklogic.nifi.processor.QueryMarkLogic.getDocs(QueryMarkLogic.java:169)
    at com.marklogic.nifi.processor.QueryMarkLogic.lambda$onTrigger$1(QueryMarkLogic.java:143)
    at com.marklogic.client.datamovement.impl.QueryBatcherImpl$1$1.run(QueryBatcherImpl.java:716)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
2018-05-18 14:35:30,270 ERROR [pool-27-thread-3] c.m.c.datamovement.impl.QueryBatcherImpl Exception thrown by an onUrisReady listener
org.apache.nifi.processor.exception.ProcessException: com.marklogic.client.FailedRequestException: Local message: failed to read resource at documents: Bad Request. Server Message: XDMP-RWINVAL0: The value of expression '$0'  is required to be non-zero in rule: set-transaction-timestamp
    at com.marklogic.nifi.processor.QueryMarkLogic.lambda$onTrigger$1(QueryMarkLogic.java:158)
    at com.marklogic.client.datamovement.impl.QueryBatcherImpl$1$1.run(QueryBatcherImpl.java:716)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Caused by: com.marklogic.client.FailedRequestException: Local message: failed to read resource at documents: Bad Request. Server Message: XDMP-RWINVAL0: The value of expression '$0'  is required to be non-zero in rule: set-transaction-timestamp
    at com.marklogic.client.impl.OkHttpServices.checkStatus(OkHttpServices.java:4317)
    at com.marklogic.client.impl.OkHttpServices.getIteratedResourceImpl(OkHttpServices.java:3081)
    at com.marklogic.client.impl.OkHttpServices.getBulkDocumentsImpl(OkHttpServices.java:975)
    at com.marklogic.client.impl.OkHttpServices.getBulkDocuments(OkHttpServices.java:860)
    at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:461)
    at com.marklogic.client.impl.GenericDocumentImpl.read(GenericDocumentImpl.java:23)
    at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:439)
    at com.marklogic.client.impl.GenericDocumentImpl.read(GenericDocumentImpl.java:23)
    at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:408)
    at com.marklogic.client.impl.GenericDocumentImpl.read(GenericDocumentImpl.java:23)
    at com.marklogic.nifi.processor.QueryMarkLogic.getDocs(QueryMarkLogic.java:169)
    at com.marklogic.nifi.processor.QueryMarkLogic.lambda$onTrigger$1(QueryMarkLogic.java:143)
    ... 4 common frames omitted
2018-05-18 14:35:30,271 INFO [Timer-Driven Process Thread-2] c.m.c.datamovement.impl.QueryBatcherImpl Job complete, jobBatchNumber=0, jobResultsSoFar=0
2018-05-18 14:35:30,272 INFO [Timer-Driven Process Thread-2] c.m.c.e.d.job.SimpleQueryBatcherJob Completed: Generic query batcher job

What am I doing wrong here ?


Solution

  • Try it with "Consistent snapshot" set to false. If that works, it's due to some issues we're trying to resolve when it's set to true.