You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Mandeep Gill (JIRA)" <ji...@apache.org> on 2018/11/13 18:26:01 UTC

[jira] [Updated] (NIFI-5817) QueryRecord processor exception when using JsonPath expression language

     [ https://issues.apache.org/jira/browse/NIFI-5817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mandeep Gill updated NIFI-5817:
-------------------------------
    Environment: Linux x64 (Fedora 29) with OpenJSDK 8 (openjdk version "1.8.0_191")  (was: Linux (Fedora 29) with OpenJSDK 8 (openjdk version "1.8.0_191"))

> QueryRecord processor exception when using JsonPath expression language 
> ------------------------------------------------------------------------
>
>                 Key: NIFI-5817
>                 URL: https://issues.apache.org/jira/browse/NIFI-5817
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.8.0
>         Environment: Linux x64 (Fedora 29) with OpenJSDK 8 (openjdk version "1.8.0_191")
>            Reporter: Mandeep Gill
>            Priority: Major
>         Attachments: QueryRecord_JsonPath_Issue.xml
>
>
> (From email to the users list)
>  
>  I'm hitting an issue using the "jsonPath" expression language function to extract a query to use with the QueryRecord processor. The processor works fine if the expression language subject is contained within the process group variable registry, but fails upon starting with an `AttributeExpressionLanguageException` if the subject was expected to to exist within a flowfile attribute [1]
>   
>  I've attached a template generated on NiFi 1.8.0 demonstrating the problem - it only appears to be an issue with dynamic outputs from the QueryRecord processor, as the same expression language statement works fine when used as part of UpdateAttribute processor with the subject in a flowfile attribute as per the template. I've dug into the codebase and can trace the error to the `evaluate` function within the `JsonPathEvaluator` class, which throws the exception if the variable can not be referenced. I have a local fix at [https://github.com/apache/nifi/compare/master...nstack:fix/jsonpath] that returns `StringQueryResult("")` if the subject is empty instead of throwing the exception and this appears to work.
>   
>  However I'm not sure if this is the correct fix as UpdateAttribute works, perhaps the problem is instead in QueryRecord eagerly evaluating the queries thus triggering the `evaluate` function.
>   
> [1] 2018-11-13 14:46:24,899 ERROR [Timer-Driven Process Thread-1] o.a.nifi.processors.standard.QueryRecord QueryRecord[id=0d5684e2-0167-1000-74c1-eb29a1401981] Failed to properly initialize Processor. If still scheduled to run, NiFi will attempt to initialize and run the Processor again after the 'Administrative Yield Duration' has elapsed. Failure is due to java.lang.reflect.InvocationTargetException: java.lang.reflect.InvocationTargetException
> java.lang.reflect.InvocationTargetException: null
> at sun.reflect.GeneratedMethodAccessor916.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:142)
> at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:130)
> at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:75)
> at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotation(ReflectionUtils.java:52)
> at org.apache.nifi.controller.StandardProcessorNode.lambda$initiateStart$4(StandardProcessorNode.java:1499)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageException: Subject is empty
> at org.apache.nifi.attribute.expression.language.evaluation.functions.JsonPathEvaluator.evaluate(JsonPathEvaluator.java:66)
> at org.apache.nifi.attribute.expression.language.Query.evaluate(Query.java:315)
> at org.apache.nifi.attribute.expression.language.Query.evaluateExpression(Query.java:203)
> at org.apache.nifi.attribute.expression.language.CompiledExpression.evaluate(CompiledExpression.java:58)
> at org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:51)
> at org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(StandardPropertyValue.java:160)
> at org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(StandardPropertyValue.java:148)
> at org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(StandardPropertyValue.java:113)
> at org.apache.nifi.processors.standard.QueryRecord.setupQueues(QueryRecord.java:443)
> ... 14 common frames omitted



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)