Support Questions
Find answers, ask questions, and share your expertise

NiFi: Cannot use '@GrabConfig(systemClassLoader=true)' in groovy script (ExecuteScript processor)

Solved Go to solution

NiFi: Cannot use '@GrabConfig(systemClassLoader=true)' in groovy script (ExecuteScript processor)

New Contributor

Hi!

I would like to use 'mysql:mysql-connector-java:5.1.39' in a groovy script.
The annotation '@GrabConfig(systemClassLoader=true)' is normally required when using this library, but it seems that it is not supported from within scripts that are run via the ExecuteScript processor (error message is 'no suitable classloader found for grab').
I've also tried including the JAR by manually downloading it and setting the 'Module Directory' property of the flowfile, with no success.
Is there a workaround that would allow me to use this mysql connector from within a script?

Thank you,
Nicholas

1 ACCEPTED SOLUTION

Accepted Solutions

Re: NiFi: Cannot use '@GrabConfig(systemClassLoader=true)' in groovy script (ExecuteScript processor)

Super Guru

What version of NiFi are you using? You should definitely be able to use it when it is specified in the Module Directory property. Alternatively, if you just need a Connection from the driver, you could create a DBCPConnectionPool that uses that JAR, then access that controller service to get a Connection. See my blog post and the documentation for ExecuteGroovyScript (which makes this a lot easier than the plain ExecuteScript).

View solution in original post

2 REPLIES 2

Re: NiFi: Cannot use '@GrabConfig(systemClassLoader=true)' in groovy script (ExecuteScript processor)

Super Guru

What version of NiFi are you using? You should definitely be able to use it when it is specified in the Module Directory property. Alternatively, if you just need a Connection from the driver, you could create a DBCPConnectionPool that uses that JAR, then access that controller service to get a Connection. See my blog post and the documentation for ExecuteGroovyScript (which makes this a lot easier than the plain ExecuteScript).

View solution in original post

Re: NiFi: Cannot use '@GrabConfig(systemClassLoader=true)' in groovy script (ExecuteScript processor)

New Contributor

Wow, that was fast! :)

I'm currently playing around with an older version of NIFI (1.2.0). I'll upgrade to the latest available and get back at you with results. Thank you very much!

Nicholas