You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Matt Burgess (Jira)" <ji...@apache.org> on 2021/07/15 15:37:00 UTC

[jira] [Resolved] (NIFI-8715) Nifi 1.13 Execute script raising issue "failed to process due to org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: SyntaxError: no viable alternative at input 'import' "

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

Matt Burgess resolved NIFI-8715.
--------------------------------
    Fix Version/s: 1.14.0
       Resolution: Fixed

Resolving as fixed as I cannot reproduce with the 1.14.0 release. If you are still seeing this behavior please reopen as needed.

> Nifi 1.13 Execute script raising issue "failed to process due to org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: SyntaxError: no viable alternative at input 'import' "
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-8715
>                 URL: https://issues.apache.org/jira/browse/NIFI-8715
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework, Core UI
>    Affects Versions: 1.13.2
>         Environment: Ubuntu 18.04 
> 16 GB RAM
> intel i7 10th gen
>            Reporter: suresh b
>            Priority: Major
>              Labels: newbie
>             Fix For: 1.14.0
>
>
>  
> {code:java}
> import json
> from org.apache.commons.io import IOUtils
> from java.nio.charset import StandardCharsets
> from org.apache.nifi.processor.io import StreamCallback,InputStreamCallback, OutputStreamCallback
> class PyInputStreamCallback(InputStreamCallback):
>  def __init__(self):
>  self.json_content = {}
>  def process(self, inputStream):
>  text = IOUtils.toString(inputStream, StandardCharsets.UTF_8)
>  print(" text %s " %text)
> class OutputWrite(OutputStreamCallback):
>  def __init__(self, obj):
>  self.obj = obj
>  def process(self, outputStream):
>  outputStream.write(bytearray(json.dumps(self.obj).encode('utf')))
> ###end class###
> flowfile = session.get()
> if flowfile != None:
>  py_is = PyInputStreamCallback()
>  session.read(flowfile, py_is)
>  flowfile = session.write(flowfile, OutputWrite(py_is.json_content))
>  session.transfer(flowfile, REL_SUCCESS)
>  session.commit()
>  session.close()
> {code}
>  
> 2021-06-18 16:00:00,513 ERROR [Timer-Driven Process Thread-10] o.a.nifi.processors.script.ExecuteScript ExecuteScript[id=f2ea959c-c0e5-3698-42a5-19993fbdb19b] ExecuteScript[id=f2ea959c-c0e5-3698-42a5-19993fbdb19b] failed to process due to org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: SyntaxError: no viable alternative at input 'import' in <script> at line number 2 at column number 59; rolling back session: org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: SyntaxError: no viable alternative at input 'import' in <script> at line number 2 at column number 59
> Above script is working fine in 1.11.4 nifi version, but it is raising exception in latest nifi version.  can any one help me how to fix it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)