nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Payne <>
Subject Re: JsonPath expression language exception with QueryRecord processor
Date Tue, 13 Nov 2018 18:21:33 GMT
Hi Mandeep,

I think this may actually be a bug in QueryRecord, in the way that it's handling the Expression
Do please file a JIRA for that. In the meantime, you can probably work around the issue using
the replaceNull() method.
So if your expression was ${myAttribute:jsonPath('/hello')} you could instead use ${myAttribute:replaceNull('{}'):jsonPath('/hello')}


On Nov 13, 2018, at 10:16 AM, Mandeep Gill <<>>

Hi there,

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 processors, 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
that returns StringQueryResult("") if the subject is empty instead of throwing the exception
and this appears to work however I wonder that as UpdateAttribute works if the problem is
instead in QueryRecord eagerly evaluating the queries.

Any help would be appreciated.


[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: null
at sun.reflect.GeneratedMethodAccessor916.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotation(
at org.apache.nifi.controller.StandardProcessorNode.lambda$initiateStart$4(
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(
at java.util.concurrent.ScheduledThreadPoolExecutor$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
Caused by: org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageException:
Subject is empty
at org.apache.nifi.attribute.expression.language.evaluation.functions.JsonPathEvaluator.evaluate(
at org.apache.nifi.attribute.expression.language.Query.evaluate(
at org.apache.nifi.attribute.expression.language.Query.evaluateExpression(
at org.apache.nifi.attribute.expression.language.CompiledExpression.evaluate(
at org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(
at org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(
at org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(
at org.apache.nifi.attribute.expression.language.StandardPropertyValue.evaluateAttributeExpressions(
at org.apache.nifi.processors.standard.QueryRecord.setupQueues(
... 14 common frames omitted


Mandeep Gill<> / +44 7961822575


View raw message