Details
-
Bug
-
Status: Resolved
-
Trivial
-
Resolution: Fixed
-
1.13.2
-
Ubuntu 20.04 LTS
openjdk version "11.0.10" 2021-01-19
Description
InvokeScriptedProcessor works well when started for the first time.
The Processor become invalid after stopped and cannot be started anymore, also after change parameters. This message appears : Unable to load script: No processor was defined by the script.
We have to delete and recreate the Processor to start it.
The Processor is configured like this :
Script Engine : python
Script body :
from org.apache.nifi.processor import Processor, Relationship from java.lang import Throwableclass E(): def __init__(self): pass def executeScript(self,session, context, log, REL_SUCCESS, REL_FAILURE): flowFile = session.get() if (flowFile != None): flowFile = session.putAttribute(flowFile, 'myAttr', 'myValue') session.transfer(flowFile, REL_SUCCESS) #end classclass JythonProcessor(Processor): REL_SUCCESS = Relationship.Builder().name("success").description('FlowFiles that were successfully processed are routed here').build() REL_FAILURE = Relationship.Builder().name("failure").description('FlowFiles that were not successfully processed are routed here').build() log = None e = E() def initialize(self,context): self.log = context.logger def getRelationships(self): return set([self.REL_SUCCESS, self.REL_FAILURE]) def validate(self,context): pass def onPropertyModified(self,descriptor, oldValue, newValue): pass def getPropertyDescriptors(self): return [] def getIdentifier(self): return None def onTrigger(self,context, sessionFactory): session = sessionFactory.createSession() try: self.e.executeScript(session, context, self.log, self.REL_SUCCESS, self.REL_FAILURE) session.commit() except Throwable, t: self.log.error('{} failed to process due to {}; rolling back session', [self, t]) session.rollback(true) raise t #end classprocessor = JythonProcessor()
The logs :
2021-04-28 14:03:06,438 INFO [NiFi Web Server-93413] o.a.nifi.groups.StandardProcessGroup InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] added to StandardProcessGroup[identifier=46a63780-e64b-1f50-ffff-ffffe1229048,name=TEST_ISP] 2021-04-28 14:03:43,335 INFO [NiFi Web Server-93416] o.a.n.c.s.StandardProcessScheduler Starting InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] 2021-04-28 14:03:43,335 INFO [NiFi Web Server-93416] o.a.n.controller.StandardProcessorNode Starting InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] 2021-04-28 14:03:43,336 INFO [Timer-Driven Process Thread-1] o.a.n.c.s.TimerDrivenSchedulingAgent Scheduled InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] to run with 1 threads 2021-04-28 14:04:03,432 INFO [NiFi Web Server-91830] o.a.n.c.s.StandardProcessScheduler Stopping InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] 2021-04-28 14:04:03,432 INFO [NiFi Web Server-91830] o.a.n.controller.StandardProcessorNode Stopping processor: InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] 2021-04-28 14:04:03,432 INFO [Timer-Driven Process Thread-4] o.a.n.c.s.TimerDrivenSchedulingAgent Stopped scheduling InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] to run 2021-04-28 14:04:03,432 INFO [NiFi Web Server-91830] o.a.n.c.s.StandardProcessScheduler Stopping InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] 2021-04-28 14:04:03,432 INFO [NiFi Web Server-91830] o.a.n.controller.StandardProcessorNode Stopping processor: InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] 2021-04-28 14:04:03,432 INFO [Timer-Driven Process Thread-4] o.a.n.c.s.TimerDrivenSchedulingAgent Stopped scheduling InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] to run 2021-04-28 14:04:06,412 ERROR [Validate Components Thread-5] o.a.n.p.script.InvokeScriptedProcessor InvokeScriptedProcessor[id=46a64d6b-e64b-1f50-ffff-ffffc26b9411] Unable to load script: No processor was defined by the script.: javax.script.ScriptException: No processor was defined by the script. javax.script.ScriptException: No processor was defined by the script. at org.apache.nifi.processors.script.InvokeScriptedProcessor.reloadScript(InvokeScriptedProcessor.java:421) at org.apache.nifi.processors.script.InvokeScriptedProcessor.reloadScriptBody(InvokeScriptedProcessor.java:310) at org.apache.nifi.processors.script.InvokeScriptedProcessor.setup(InvokeScriptedProcessor.java:230) at org.apache.nifi.processors.script.InvokeScriptedProcessor.customValidate(InvokeScriptedProcessor.java:479) at org.apache.nifi.components.AbstractConfigurableComponent.validate(AbstractConfigurableComponent.java:145) at org.apache.nifi.controller.AbstractComponentNode.computeValidationErrors(AbstractComponentNode.java:609) at org.apache.nifi.controller.StandardProcessorNode.computeValidationErrors(StandardProcessorNode.java:1054) at org.apache.nifi.controller.AbstractComponentNode.performValidation(AbstractComponentNode.java:576) at org.apache.nifi.controller.AbstractComponentNode.performValidation(AbstractComponentNode.java:590) at org.apache.nifi.components.validation.StandardValidationTrigger.trigger(StandardValidationTrigger.java:52) at org.apache.nifi.components.validation.TriggerValidationTask.run(TriggerValidationTask.java:50) at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)
Attachments
Issue Links
- is fixed by
-
NIFI-8330 JythonScriptEngineConfigurator needs to recompile on init()
- Resolved