[jira] [Commented] (NIFI-9944) InvokeScriptedProcessor not seeing classes in imported Modules

2022-05-09 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-9944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17533933#comment-17533933
 ] 

ASF subversion and git services commented on NIFI-9944:
---

Commit 028982ce0b26ebab1eb3be72dd9c977a32c732a4 in nifi's branch 
refs/heads/support/nifi-1.16 from David Handermann
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=028982ce0b ]

NIFI-9944 Configured maven-dependency-plugin for JavaScript test JAR

Signed-off-by: Matthew Burgess 

This closes #5997


> InvokeScriptedProcessor not seeing classes in imported Modules
> --
>
> Key: NIFI-9944
> URL: https://issues.apache.org/jira/browse/NIFI-9944
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Core Framework
>Affects Versions: 1.15.3
> Environment: Linux / GCP
>Reporter: Armin Aschoff
>Assignee: Matt Burgess
>Priority: Critical
> Fix For: 1.17.0, 1.16.2
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Create a new InvokeScriptedProcessor.
> Set Module Directory: ./scripts/jars/commons-text-1.6/
>  - have tried setting absolute & relative paths, paths to directories, paths 
> to jar files, different versions of commons-text, trailing slash/no trailing 
> slash, etc.  No differences
> Set script engine ECMAScript
> Write js script that tries to call a static method in commons-text.  Script 
> can be either script file or script body, no difference
> Always get ClassNotFoundException error:
> {noformat}
> Component is invalid: 'ScriptValidation' validated against 
> './scripts/testCsv.js' is invalid because Unable to load script due to 
> java.lang.ClassNotFoundException: 
> org.apache.commons.text.StringEscapeUtils{noformat}
> Definitely not a dupe of https://issues.apache.org/jira/browse/NIFI-9896 - 
> affects both script file & body, error message changes after following the 
> workaround in 9896, plus removing references to 
> org.apache.commons.text.StringEscapeUtils in the script (but still retaining 
> the Module Directory setting) allows the script to function normally.
> Have tried Java.type and Packages. to try to access the class.
> Any/all help much appreciated as rapidly losing remaining hair!
> Sample script:
> {code:java}
> // base interface & class stuff
> var Processor = Java.type("org.apache.nifi.processor.Processor")
> var Relationship = Java.type("org.apache.nifi.processor.Relationship")
> var HashSet = Java.type("java.util.HashSet")
> var log = null
> // stuff to read/write flowfile content
> var InputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.InputStreamCallback")
> var OutputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.OutputStreamCallback")
> var IOUtils = Java.type("org.apache.commons.io.IOUtils")
> var StandardCharsets = Java.type("java.nio.charset.StandardCharsets")
> var StringEscapeUtils = Java.type("org.apache.commons.text.StringEscapeUtils")
> function getPropertyDescriptors() { return []}
> // === Define output relationships 
> var REL_SUCCESS = new 
> Relationship.Builder().name("success").description("FlowFiles that were 
> successfully processed are routed here").build()
> function getRelationships() {
>     var r = new HashSet()
>     r.add(REL_SUCCESS)
>     return r
> }
> //===
> // Execute the main script when triggered
> function onTrigger(context, sessionFactory) {
>     var session = sessionFactory.createSession()
>     var flowFile = session.get()
>     if (flowFile !== null) {
>         var test = "boo"
>         test = StringEscapeUtils.escapeCsv("foo")
>         log.warn(test)
>         session.transfer(flowFile, REL_SUCCESS)
>     }    
> session.commit()
> }
> // ==
> // Other functions required to satisfy interface contract
> function initialize(context) {log = context.logger}
> function validate(context) {return null}
> function getPropertyDescriptor(name) {return 
> getPropertyDescriptors().find(function (property) {
>         return property.getName().equalsIgnoreCase(name)    
> })}
> function onPropertyModified(descriptor, oldValue, newValue) {return null}
> function getIdentifier() {return null}
> processor = this
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (NIFI-9944) InvokeScriptedProcessor not seeing classes in imported Modules

2022-05-09 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-9944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17533932#comment-17533932
 ] 

ASF subversion and git services commented on NIFI-9944:
---

Commit 008ecfafb5048c68f93fd8f12decc9a0706a7414 in nifi's branch 
refs/heads/support/nifi-1.16 from Matt Burgess
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=008ecfafb5 ]

NIFI-9944: Fixed issue with using modules in InvokeScriptedProcessor


> InvokeScriptedProcessor not seeing classes in imported Modules
> --
>
> Key: NIFI-9944
> URL: https://issues.apache.org/jira/browse/NIFI-9944
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Core Framework
>Affects Versions: 1.15.3
> Environment: Linux / GCP
>Reporter: Armin Aschoff
>Assignee: Matt Burgess
>Priority: Critical
> Fix For: 1.17.0, 1.16.2
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Create a new InvokeScriptedProcessor.
> Set Module Directory: ./scripts/jars/commons-text-1.6/
>  - have tried setting absolute & relative paths, paths to directories, paths 
> to jar files, different versions of commons-text, trailing slash/no trailing 
> slash, etc.  No differences
> Set script engine ECMAScript
> Write js script that tries to call a static method in commons-text.  Script 
> can be either script file or script body, no difference
> Always get ClassNotFoundException error:
> {noformat}
> Component is invalid: 'ScriptValidation' validated against 
> './scripts/testCsv.js' is invalid because Unable to load script due to 
> java.lang.ClassNotFoundException: 
> org.apache.commons.text.StringEscapeUtils{noformat}
> Definitely not a dupe of https://issues.apache.org/jira/browse/NIFI-9896 - 
> affects both script file & body, error message changes after following the 
> workaround in 9896, plus removing references to 
> org.apache.commons.text.StringEscapeUtils in the script (but still retaining 
> the Module Directory setting) allows the script to function normally.
> Have tried Java.type and Packages. to try to access the class.
> Any/all help much appreciated as rapidly losing remaining hair!
> Sample script:
> {code:java}
> // base interface & class stuff
> var Processor = Java.type("org.apache.nifi.processor.Processor")
> var Relationship = Java.type("org.apache.nifi.processor.Relationship")
> var HashSet = Java.type("java.util.HashSet")
> var log = null
> // stuff to read/write flowfile content
> var InputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.InputStreamCallback")
> var OutputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.OutputStreamCallback")
> var IOUtils = Java.type("org.apache.commons.io.IOUtils")
> var StandardCharsets = Java.type("java.nio.charset.StandardCharsets")
> var StringEscapeUtils = Java.type("org.apache.commons.text.StringEscapeUtils")
> function getPropertyDescriptors() { return []}
> // === Define output relationships 
> var REL_SUCCESS = new 
> Relationship.Builder().name("success").description("FlowFiles that were 
> successfully processed are routed here").build()
> function getRelationships() {
>     var r = new HashSet()
>     r.add(REL_SUCCESS)
>     return r
> }
> //===
> // Execute the main script when triggered
> function onTrigger(context, sessionFactory) {
>     var session = sessionFactory.createSession()
>     var flowFile = session.get()
>     if (flowFile !== null) {
>         var test = "boo"
>         test = StringEscapeUtils.escapeCsv("foo")
>         log.warn(test)
>         session.transfer(flowFile, REL_SUCCESS)
>     }    
> session.commit()
> }
> // ==
> // Other functions required to satisfy interface contract
> function initialize(context) {log = context.logger}
> function validate(context) {return null}
> function getPropertyDescriptor(name) {return 
> getPropertyDescriptors().find(function (property) {
>         return property.getName().equalsIgnoreCase(name)    
> })}
> function onPropertyModified(descriptor, oldValue, newValue) {return null}
> function getIdentifier() {return null}
> processor = this
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (NIFI-9944) InvokeScriptedProcessor not seeing classes in imported Modules

2022-04-27 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-9944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17528989#comment-17528989
 ] 

ASF subversion and git services commented on NIFI-9944:
---

Commit 8b08795e18f69825e2b73760af79ab0530f93d70 in nifi's branch 
refs/heads/NIFI-9428 from David Handermann
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=8b08795e18 ]

NIFI-9944 Configured maven-dependency-plugin for JavaScript test JAR

Signed-off-by: Matthew Burgess 

This closes #5997


> InvokeScriptedProcessor not seeing classes in imported Modules
> --
>
> Key: NIFI-9944
> URL: https://issues.apache.org/jira/browse/NIFI-9944
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Core Framework
>Affects Versions: 1.15.3
> Environment: Linux / GCP
>Reporter: Armin Aschoff
>Assignee: Matt Burgess
>Priority: Critical
> Fix For: 1.17.0
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Create a new InvokeScriptedProcessor.
> Set Module Directory: ./scripts/jars/commons-text-1.6/
>  - have tried setting absolute & relative paths, paths to directories, paths 
> to jar files, different versions of commons-text, trailing slash/no trailing 
> slash, etc.  No differences
> Set script engine ECMAScript
> Write js script that tries to call a static method in commons-text.  Script 
> can be either script file or script body, no difference
> Always get ClassNotFoundException error:
> {noformat}
> Component is invalid: 'ScriptValidation' validated against 
> './scripts/testCsv.js' is invalid because Unable to load script due to 
> java.lang.ClassNotFoundException: 
> org.apache.commons.text.StringEscapeUtils{noformat}
> Definitely not a dupe of https://issues.apache.org/jira/browse/NIFI-9896 - 
> affects both script file & body, error message changes after following the 
> workaround in 9896, plus removing references to 
> org.apache.commons.text.StringEscapeUtils in the script (but still retaining 
> the Module Directory setting) allows the script to function normally.
> Have tried Java.type and Packages. to try to access the class.
> Any/all help much appreciated as rapidly losing remaining hair!
> Sample script:
> {code:java}
> // base interface & class stuff
> var Processor = Java.type("org.apache.nifi.processor.Processor")
> var Relationship = Java.type("org.apache.nifi.processor.Relationship")
> var HashSet = Java.type("java.util.HashSet")
> var log = null
> // stuff to read/write flowfile content
> var InputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.InputStreamCallback")
> var OutputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.OutputStreamCallback")
> var IOUtils = Java.type("org.apache.commons.io.IOUtils")
> var StandardCharsets = Java.type("java.nio.charset.StandardCharsets")
> var StringEscapeUtils = Java.type("org.apache.commons.text.StringEscapeUtils")
> function getPropertyDescriptors() { return []}
> // === Define output relationships 
> var REL_SUCCESS = new 
> Relationship.Builder().name("success").description("FlowFiles that were 
> successfully processed are routed here").build()
> function getRelationships() {
>     var r = new HashSet()
>     r.add(REL_SUCCESS)
>     return r
> }
> //===
> // Execute the main script when triggered
> function onTrigger(context, sessionFactory) {
>     var session = sessionFactory.createSession()
>     var flowFile = session.get()
>     if (flowFile !== null) {
>         var test = "boo"
>         test = StringEscapeUtils.escapeCsv("foo")
>         log.warn(test)
>         session.transfer(flowFile, REL_SUCCESS)
>     }    
> session.commit()
> }
> // ==
> // Other functions required to satisfy interface contract
> function initialize(context) {log = context.logger}
> function validate(context) {return null}
> function getPropertyDescriptor(name) {return 
> getPropertyDescriptors().find(function (property) {
>         return property.getName().equalsIgnoreCase(name)    
> })}
> function onPropertyModified(descriptor, oldValue, newValue) {return null}
> function getIdentifier() {return null}
> processor = this
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (NIFI-9944) InvokeScriptedProcessor not seeing classes in imported Modules

2022-04-27 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-9944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17528988#comment-17528988
 ] 

ASF subversion and git services commented on NIFI-9944:
---

Commit 4b66299cf656e3a835d9926215a847607ec2397e in nifi's branch 
refs/heads/NIFI-9428 from Matt Burgess
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=4b66299cf6 ]

NIFI-9944: Fixed issue with using modules in InvokeScriptedProcessor


> InvokeScriptedProcessor not seeing classes in imported Modules
> --
>
> Key: NIFI-9944
> URL: https://issues.apache.org/jira/browse/NIFI-9944
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Core Framework
>Affects Versions: 1.15.3
> Environment: Linux / GCP
>Reporter: Armin Aschoff
>Assignee: Matt Burgess
>Priority: Critical
> Fix For: 1.17.0
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Create a new InvokeScriptedProcessor.
> Set Module Directory: ./scripts/jars/commons-text-1.6/
>  - have tried setting absolute & relative paths, paths to directories, paths 
> to jar files, different versions of commons-text, trailing slash/no trailing 
> slash, etc.  No differences
> Set script engine ECMAScript
> Write js script that tries to call a static method in commons-text.  Script 
> can be either script file or script body, no difference
> Always get ClassNotFoundException error:
> {noformat}
> Component is invalid: 'ScriptValidation' validated against 
> './scripts/testCsv.js' is invalid because Unable to load script due to 
> java.lang.ClassNotFoundException: 
> org.apache.commons.text.StringEscapeUtils{noformat}
> Definitely not a dupe of https://issues.apache.org/jira/browse/NIFI-9896 - 
> affects both script file & body, error message changes after following the 
> workaround in 9896, plus removing references to 
> org.apache.commons.text.StringEscapeUtils in the script (but still retaining 
> the Module Directory setting) allows the script to function normally.
> Have tried Java.type and Packages. to try to access the class.
> Any/all help much appreciated as rapidly losing remaining hair!
> Sample script:
> {code:java}
> // base interface & class stuff
> var Processor = Java.type("org.apache.nifi.processor.Processor")
> var Relationship = Java.type("org.apache.nifi.processor.Relationship")
> var HashSet = Java.type("java.util.HashSet")
> var log = null
> // stuff to read/write flowfile content
> var InputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.InputStreamCallback")
> var OutputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.OutputStreamCallback")
> var IOUtils = Java.type("org.apache.commons.io.IOUtils")
> var StandardCharsets = Java.type("java.nio.charset.StandardCharsets")
> var StringEscapeUtils = Java.type("org.apache.commons.text.StringEscapeUtils")
> function getPropertyDescriptors() { return []}
> // === Define output relationships 
> var REL_SUCCESS = new 
> Relationship.Builder().name("success").description("FlowFiles that were 
> successfully processed are routed here").build()
> function getRelationships() {
>     var r = new HashSet()
>     r.add(REL_SUCCESS)
>     return r
> }
> //===
> // Execute the main script when triggered
> function onTrigger(context, sessionFactory) {
>     var session = sessionFactory.createSession()
>     var flowFile = session.get()
>     if (flowFile !== null) {
>         var test = "boo"
>         test = StringEscapeUtils.escapeCsv("foo")
>         log.warn(test)
>         session.transfer(flowFile, REL_SUCCESS)
>     }    
> session.commit()
> }
> // ==
> // Other functions required to satisfy interface contract
> function initialize(context) {log = context.logger}
> function validate(context) {return null}
> function getPropertyDescriptor(name) {return 
> getPropertyDescriptors().find(function (property) {
>         return property.getName().equalsIgnoreCase(name)    
> })}
> function onPropertyModified(descriptor, oldValue, newValue) {return null}
> function getIdentifier() {return null}
> processor = this
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (NIFI-9944) InvokeScriptedProcessor not seeing classes in imported Modules

2022-04-27 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-9944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17528805#comment-17528805
 ] 

ASF subversion and git services commented on NIFI-9944:
---

Commit 8b08795e18f69825e2b73760af79ab0530f93d70 in nifi's branch 
refs/heads/main from David Handermann
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=8b08795e18 ]

NIFI-9944 Configured maven-dependency-plugin for JavaScript test JAR

Signed-off-by: Matthew Burgess 

This closes #5997


> InvokeScriptedProcessor not seeing classes in imported Modules
> --
>
> Key: NIFI-9944
> URL: https://issues.apache.org/jira/browse/NIFI-9944
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Core Framework
>Affects Versions: 1.15.3
> Environment: Linux / GCP
>Reporter: Armin Aschoff
>Assignee: Matt Burgess
>Priority: Critical
> Fix For: 1.17.0
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Create a new InvokeScriptedProcessor.
> Set Module Directory: ./scripts/jars/commons-text-1.6/
>  - have tried setting absolute & relative paths, paths to directories, paths 
> to jar files, different versions of commons-text, trailing slash/no trailing 
> slash, etc.  No differences
> Set script engine ECMAScript
> Write js script that tries to call a static method in commons-text.  Script 
> can be either script file or script body, no difference
> Always get ClassNotFoundException error:
> {noformat}
> Component is invalid: 'ScriptValidation' validated against 
> './scripts/testCsv.js' is invalid because Unable to load script due to 
> java.lang.ClassNotFoundException: 
> org.apache.commons.text.StringEscapeUtils{noformat}
> Definitely not a dupe of https://issues.apache.org/jira/browse/NIFI-9896 - 
> affects both script file & body, error message changes after following the 
> workaround in 9896, plus removing references to 
> org.apache.commons.text.StringEscapeUtils in the script (but still retaining 
> the Module Directory setting) allows the script to function normally.
> Have tried Java.type and Packages. to try to access the class.
> Any/all help much appreciated as rapidly losing remaining hair!
> Sample script:
> {code:java}
> // base interface & class stuff
> var Processor = Java.type("org.apache.nifi.processor.Processor")
> var Relationship = Java.type("org.apache.nifi.processor.Relationship")
> var HashSet = Java.type("java.util.HashSet")
> var log = null
> // stuff to read/write flowfile content
> var InputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.InputStreamCallback")
> var OutputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.OutputStreamCallback")
> var IOUtils = Java.type("org.apache.commons.io.IOUtils")
> var StandardCharsets = Java.type("java.nio.charset.StandardCharsets")
> var StringEscapeUtils = Java.type("org.apache.commons.text.StringEscapeUtils")
> function getPropertyDescriptors() { return []}
> // === Define output relationships 
> var REL_SUCCESS = new 
> Relationship.Builder().name("success").description("FlowFiles that were 
> successfully processed are routed here").build()
> function getRelationships() {
>     var r = new HashSet()
>     r.add(REL_SUCCESS)
>     return r
> }
> //===
> // Execute the main script when triggered
> function onTrigger(context, sessionFactory) {
>     var session = sessionFactory.createSession()
>     var flowFile = session.get()
>     if (flowFile !== null) {
>         var test = "boo"
>         test = StringEscapeUtils.escapeCsv("foo")
>         log.warn(test)
>         session.transfer(flowFile, REL_SUCCESS)
>     }    
> session.commit()
> }
> // ==
> // Other functions required to satisfy interface contract
> function initialize(context) {log = context.logger}
> function validate(context) {return null}
> function getPropertyDescriptor(name) {return 
> getPropertyDescriptors().find(function (property) {
>         return property.getName().equalsIgnoreCase(name)    
> })}
> function onPropertyModified(descriptor, oldValue, newValue) {return null}
> function getIdentifier() {return null}
> processor = this
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (NIFI-9944) InvokeScriptedProcessor not seeing classes in imported Modules

2022-04-27 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-9944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17528804#comment-17528804
 ] 

ASF subversion and git services commented on NIFI-9944:
---

Commit 4b66299cf656e3a835d9926215a847607ec2397e in nifi's branch 
refs/heads/main from Matt Burgess
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=4b66299cf6 ]

NIFI-9944: Fixed issue with using modules in InvokeScriptedProcessor


> InvokeScriptedProcessor not seeing classes in imported Modules
> --
>
> Key: NIFI-9944
> URL: https://issues.apache.org/jira/browse/NIFI-9944
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Core Framework
>Affects Versions: 1.15.3
> Environment: Linux / GCP
>Reporter: Armin Aschoff
>Assignee: Matt Burgess
>Priority: Critical
> Fix For: 1.17.0
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Create a new InvokeScriptedProcessor.
> Set Module Directory: ./scripts/jars/commons-text-1.6/
>  - have tried setting absolute & relative paths, paths to directories, paths 
> to jar files, different versions of commons-text, trailing slash/no trailing 
> slash, etc.  No differences
> Set script engine ECMAScript
> Write js script that tries to call a static method in commons-text.  Script 
> can be either script file or script body, no difference
> Always get ClassNotFoundException error:
> {noformat}
> Component is invalid: 'ScriptValidation' validated against 
> './scripts/testCsv.js' is invalid because Unable to load script due to 
> java.lang.ClassNotFoundException: 
> org.apache.commons.text.StringEscapeUtils{noformat}
> Definitely not a dupe of https://issues.apache.org/jira/browse/NIFI-9896 - 
> affects both script file & body, error message changes after following the 
> workaround in 9896, plus removing references to 
> org.apache.commons.text.StringEscapeUtils in the script (but still retaining 
> the Module Directory setting) allows the script to function normally.
> Have tried Java.type and Packages. to try to access the class.
> Any/all help much appreciated as rapidly losing remaining hair!
> Sample script:
> {code:java}
> // base interface & class stuff
> var Processor = Java.type("org.apache.nifi.processor.Processor")
> var Relationship = Java.type("org.apache.nifi.processor.Relationship")
> var HashSet = Java.type("java.util.HashSet")
> var log = null
> // stuff to read/write flowfile content
> var InputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.InputStreamCallback")
> var OutputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.OutputStreamCallback")
> var IOUtils = Java.type("org.apache.commons.io.IOUtils")
> var StandardCharsets = Java.type("java.nio.charset.StandardCharsets")
> var StringEscapeUtils = Java.type("org.apache.commons.text.StringEscapeUtils")
> function getPropertyDescriptors() { return []}
> // === Define output relationships 
> var REL_SUCCESS = new 
> Relationship.Builder().name("success").description("FlowFiles that were 
> successfully processed are routed here").build()
> function getRelationships() {
>     var r = new HashSet()
>     r.add(REL_SUCCESS)
>     return r
> }
> //===
> // Execute the main script when triggered
> function onTrigger(context, sessionFactory) {
>     var session = sessionFactory.createSession()
>     var flowFile = session.get()
>     if (flowFile !== null) {
>         var test = "boo"
>         test = StringEscapeUtils.escapeCsv("foo")
>         log.warn(test)
>         session.transfer(flowFile, REL_SUCCESS)
>     }    
> session.commit()
> }
> // ==
> // Other functions required to satisfy interface contract
> function initialize(context) {log = context.logger}
> function validate(context) {return null}
> function getPropertyDescriptor(name) {return 
> getPropertyDescriptors().find(function (property) {
>         return property.getName().equalsIgnoreCase(name)    
> })}
> function onPropertyModified(descriptor, oldValue, newValue) {return null}
> function getIdentifier() {return null}
> processor = this
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (NIFI-9944) InvokeScriptedProcessor not seeing classes in imported Modules

2022-04-25 Thread Armin Aschoff (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-9944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17527804#comment-17527804
 ] 

Armin Aschoff commented on NIFI-9944:
-

That's awesome, thanks so much [~mattyb149]!  Keeping fingers crossed for 
1.16.2! :)

> InvokeScriptedProcessor not seeing classes in imported Modules
> --
>
> Key: NIFI-9944
> URL: https://issues.apache.org/jira/browse/NIFI-9944
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Core Framework
>Affects Versions: 1.15.3
> Environment: Linux / GCP
>Reporter: Armin Aschoff
>Assignee: Matt Burgess
>Priority: Critical
> Fix For: 1.17.0
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Create a new InvokeScriptedProcessor.
> Set Module Directory: ./scripts/jars/commons-text-1.6/
>  - have tried setting absolute & relative paths, paths to directories, paths 
> to jar files, different versions of commons-text, trailing slash/no trailing 
> slash, etc.  No differences
> Set script engine ECMAScript
> Write js script that tries to call a static method in commons-text.  Script 
> can be either script file or script body, no difference
> Always get ClassNotFoundException error:
> {noformat}
> Component is invalid: 'ScriptValidation' validated against 
> './scripts/testCsv.js' is invalid because Unable to load script due to 
> java.lang.ClassNotFoundException: 
> org.apache.commons.text.StringEscapeUtils{noformat}
> Definitely not a dupe of https://issues.apache.org/jira/browse/NIFI-9896 - 
> affects both script file & body, error message changes after following the 
> workaround in 9896, plus removing references to 
> org.apache.commons.text.StringEscapeUtils in the script (but still retaining 
> the Module Directory setting) allows the script to function normally.
> Have tried Java.type and Packages. to try to access the class.
> Any/all help much appreciated as rapidly losing remaining hair!
> Sample script:
> {code:java}
> // base interface & class stuff
> var Processor = Java.type("org.apache.nifi.processor.Processor")
> var Relationship = Java.type("org.apache.nifi.processor.Relationship")
> var HashSet = Java.type("java.util.HashSet")
> var log = null
> // stuff to read/write flowfile content
> var InputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.InputStreamCallback")
> var OutputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.OutputStreamCallback")
> var IOUtils = Java.type("org.apache.commons.io.IOUtils")
> var StandardCharsets = Java.type("java.nio.charset.StandardCharsets")
> var StringEscapeUtils = Java.type("org.apache.commons.text.StringEscapeUtils")
> function getPropertyDescriptors() { return []}
> // === Define output relationships 
> var REL_SUCCESS = new 
> Relationship.Builder().name("success").description("FlowFiles that were 
> successfully processed are routed here").build()
> function getRelationships() {
>     var r = new HashSet()
>     r.add(REL_SUCCESS)
>     return r
> }
> //===
> // Execute the main script when triggered
> function onTrigger(context, sessionFactory) {
>     var session = sessionFactory.createSession()
>     var flowFile = session.get()
>     if (flowFile !== null) {
>         var test = "boo"
>         test = StringEscapeUtils.escapeCsv("foo")
>         log.warn(test)
>         session.transfer(flowFile, REL_SUCCESS)
>     }    
> session.commit()
> }
> // ==
> // Other functions required to satisfy interface contract
> function initialize(context) {log = context.logger}
> function validate(context) {return null}
> function getPropertyDescriptor(name) {return 
> getPropertyDescriptors().find(function (property) {
>         return property.getName().equalsIgnoreCase(name)    
> })}
> function onPropertyModified(descriptor, oldValue, newValue) {return null}
> function getIdentifier() {return null}
> processor = this
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (NIFI-9944) InvokeScriptedProcessor not seeing classes in imported Modules

2022-04-25 Thread Matt Burgess (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-9944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17527670#comment-17527670
 ] 

Matt Burgess commented on NIFI-9944:


Ah I saw "Module Directory" and jumped the gun. Indeed this is a related issue 
but not fixed by NIFI-9896, that turns out to be a partial fix but doesn't 
actually allow you to use classes from the modules. I'm looking into this for a 
1.16.2 or 1.17.0 and will mention on the other Jira that it's not technically 
fixed as this Jira still happens.

> InvokeScriptedProcessor not seeing classes in imported Modules
> --
>
> Key: NIFI-9944
> URL: https://issues.apache.org/jira/browse/NIFI-9944
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Core Framework
>Affects Versions: 1.15.3
> Environment: Linux / GCP
>Reporter: Armin Aschoff
>Priority: Critical
>
> Create a new InvokeScriptedProcessor.
> Set Module Directory: ./scripts/jars/commons-text-1.6/
>  - have tried setting absolute & relative paths, paths to directories, paths 
> to jar files, different versions of commons-text, trailing slash/no trailing 
> slash, etc.  No differences
> Set script engine ECMAScript
> Write js script that tries to call a static method in commons-text.  Script 
> can be either script file or script body, no difference
> Always get ClassNotFoundException error:
> {noformat}
> Component is invalid: 'ScriptValidation' validated against 
> './scripts/testCsv.js' is invalid because Unable to load script due to 
> java.lang.ClassNotFoundException: 
> org.apache.commons.text.StringEscapeUtils{noformat}
> Definitely not a dupe of https://issues.apache.org/jira/browse/NIFI-9896 - 
> affects both script file & body, error message changes after following the 
> workaround in 9896, plus removing references to 
> org.apache.commons.text.StringEscapeUtils in the script (but still retaining 
> the Module Directory setting) allows the script to function normally.
> Have tried Java.type and Packages. to try to access the class.
> Any/all help much appreciated as rapidly losing remaining hair!
> Sample script:
> {code:java}
> // base interface & class stuff
> var Processor = Java.type("org.apache.nifi.processor.Processor")
> var Relationship = Java.type("org.apache.nifi.processor.Relationship")
> var HashSet = Java.type("java.util.HashSet")
> var log = null
> // stuff to read/write flowfile content
> var InputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.InputStreamCallback")
> var OutputStreamCallback = 
> Java.type("org.apache.nifi.processor.io.OutputStreamCallback")
> var IOUtils = Java.type("org.apache.commons.io.IOUtils")
> var StandardCharsets = Java.type("java.nio.charset.StandardCharsets")
> var StringEscapeUtils = Java.type("org.apache.commons.text.StringEscapeUtils")
> function getPropertyDescriptors() { return []}
> // === Define output relationships 
> var REL_SUCCESS = new 
> Relationship.Builder().name("success").description("FlowFiles that were 
> successfully processed are routed here").build()
> function getRelationships() {
>     var r = new HashSet()
>     r.add(REL_SUCCESS)
>     return r
> }
> //===
> // Execute the main script when triggered
> function onTrigger(context, sessionFactory) {
>     var session = sessionFactory.createSession()
>     var flowFile = session.get()
>     if (flowFile !== null) {
>         var test = "boo"
>         test = StringEscapeUtils.escapeCsv("foo")
>         log.warn(test)
>         session.transfer(flowFile, REL_SUCCESS)
>     }    
> session.commit()
> }
> // ==
> // Other functions required to satisfy interface contract
> function initialize(context) {log = context.logger}
> function validate(context) {return null}
> function getPropertyDescriptor(name) {return 
> getPropertyDescriptors().find(function (property) {
>         return property.getName().equalsIgnoreCase(name)    
> })}
> function onPropertyModified(descriptor, oldValue, newValue) {return null}
> function getIdentifier() {return null}
> processor = this
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)