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

Matt Burgess resolved NIFI-4762.
--------------------------------
    Resolution: Duplicate

The issue is that you currently can't extend AbstractProcessor, you have to 
implement the Processor interface. There is a Jira and patch to support this 
(NIFI-4367), so closing this Jira as a duplicate, we can track the work there. 
I'll try to resurrect that PR and see if we can get it merged in.

> unable to use groovy from InvokeScriptedProcessor
> -------------------------------------------------
>
>                 Key: NIFI-4762
>                 URL: https://issues.apache.org/jira/browse/NIFI-4762
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.4.0
>            Reporter: Martin Mucha
>            Priority: Major
>
> Having following groovy, which just creates flowfile with sample json. 
> Processor is configured such that it has script body in scriptBody property, 
> while other property is empty.
> {code:groovy}
> import org.apache.nifi.processor.AbstractProcessor
> import org.apache.nifi.processor.ProcessContext
> import org.apache.nifi.processor.ProcessSession
> import org.apache.nifi.processor.Relationship
> import org.apache.nifi.processor.io.OutputStreamCallback
> class GenerateJsonProcessor extends AbstractProcessor{
>     def REL_SUCCESS = new 
> Relationship.Builder().name("success").description('FlowFiles that were 
> successfully processed are routed here').build()
>     @Override
>     Set<Relationship> getRelationships() {
>         return Collections.singleton(REL_SUCCESS)
>     }
>     @Override
>     void onTrigger(ProcessContext context, ProcessSession session) {
>         def newFlowFile = session.create()
>         def json = "{}"
>         session.write(newFlowFile, new OutputStreamCallback() {
>             @Override
>             void process(OutputStream out) throws IOException {
>                 def writer = new OutputStreamWriter(out);
>                 writer.write(json)
>                 writer.close()
>             }
>         })
>         session.transfer(newFlowFile, REL_SUCCESS)
> //            session.commit()
>     }
> }
> processor = new GenerateJsonProcessor()
> {code}
> produces following error:
> {code:log}
> java.lang.reflect.UndeclaredThrowableException: null
>         at com.sun.proxy.$Proxy137.validate(Unknown Source)
>         at 
> org.apache.nifi.processors.script.InvokeScriptedProcessor.customValidate(InvokeScriptedProcessor.java:465)
>         at 
> org.apache.nifi.components.AbstractConfigurableComponent.validate(AbstractConfigurableComponent.java:126)
>         at 
> org.apache.nifi.controller.AbstractConfiguredComponent.validate(AbstractConfiguredComponent.java:329)
>         at 
> org.apache.nifi.controller.StandardProcessorNode.isValid(StandardProcessorNode.java:969)
>         at 
> org.apache.nifi.controller.FlowController.getProcessorStatus(FlowController.java:2976)
>         at 
> org.apache.nifi.controller.FlowController.getGroupStatus(FlowController.java:2571)
>         at 
> org.apache.nifi.controller.FlowController.getGroupStatus(FlowController.java:2513)
>         at 
> org.apache.nifi.controller.FlowController.getGroupStatus(FlowController.java:2485)
>         at 
> org.apache.nifi.controller.FlowController.getControllerStatus(FlowController.java:2473)
>         at 
> org.apache.nifi.reporting.SiteToSiteProvenanceReportingTask.onTrigger(SiteToSiteProvenanceReportingTask.java:227)
>         at 
> org.apache.nifi.controller.tasks.ReportingTaskWrapper.run(ReportingTaskWrapper.java:41)
>         at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>         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: javax.script.ScriptException: java.lang.NullPointerException
>         at 
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:405)
>         at 
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.access$100(GroovyScriptEngineImpl.java:98)
>         at 
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl$3.invoke(GroovyScriptEngineImpl.java:446)
>         ... 19 common frames omitted
> Caused by: java.lang.NullPointerException: null
>         at java.io.File.<init>(File.java:277)
>         at 
> org.apache.nifi.processor.util.StandardValidators$FileExistsValidator.validate(StandardValidators.java:784)
>         at 
> org.apache.nifi.components.PropertyDescriptor.validate(PropertyDescriptor.java:200)
>         at 
> org.apache.nifi.components.AbstractConfigurableComponent.validate(AbstractConfigurableComponent.java:116)
>         at sun.reflect.GeneratedMethodAccessor489.invoke(Unknown Source)
> {code}
> where error lies outside of written code. I'd assume, that this line:
> org.apache.nifi.processor.util.StandardValidators$FileExistsValidator.validate(StandardValidators.java:784)
> is the most relevant from this stacktrace. Why are we validating `null` 
> valued file for existence?



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

Reply via email to