Hi,

How I noticed this:
I wanted to execute python scripts dynamically == using flowfile arguments,
but I got FileNotFoundException.

Caused by: java.util.concurrent.ExecutionException:
java.lang.reflect.InvocationTargetException
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:206)
        at
org.apache.nifi.controller.StandardProcessorNode.invokeTaskAsCancelableFuture(StandardProcessorNode.java:1465)
        ... 9 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
        at sun.reflect.GeneratedMethodAccessor542.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:137)
        at
org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:125)
        at
org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:70)
        at
org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotation(ReflectionUtils.java:47)
        at
org.apache.nifi.controller.StandardProcessorNode$1$1.call(StandardProcessorNode.java:1307)
        at
org.apache.nifi.controller.StandardProcessorNode$1$1.call(StandardProcessorNode.java:1303)
        ... 6 common frames omitted
Caused by: org.apache.nifi.processor.exception.ProcessException:
java.io.FileNotFoundException:  (No such file or directory)
        at
org.apache.nifi.processors.script.ExecuteScript.setup(ExecuteScript.java:160)
        ... 15 common frames omitted
Caused by: java.io.FileNotFoundException:  (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at
org.apache.nifi.processors.script.ExecuteScript.setup(ExecuteScript.java:155)
        ... 15 common frames omitted


After some digging I found the possible cause:
https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/script/ScriptingComponentHelper.java

Line 288:
scriptPath =
context.getProperty(ScriptingComponentUtils.SCRIPT_FILE).evaluateAttributeExpressions().getValue();

>From what I figured out from Matt's answer to a post (link below) there
should be a flowfile argument inside "..evaluateAttributeExpressions()"
https://community.hortonworks.com/questions/22448/apache-nifi-custom-processor-expression-language.html?childToView=22470#answer-22470

i.e.
scriptPath =
context.getProperty(ScriptingComponentUtils.SCRIPT_FILE).evaluateAttributeExpressions(<FLOW
FILE>).getValue();


Thanks,
Martin



--
Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/

Reply via email to