Skip to main content
peter_coppens
Gold ⭐️
December 20, 2019
Solved

ExecuteGroovyScript gives InstantiationException

Hello

 

I am trying to add an ExecuteGroovyScript processor. A simple example test works fine, but when I try to add my script it does not initiate. Exception (on hoover over) is really brief: InstantiationException thrown by groovy invokehelper. 

Script uses some external jars. As far as I can see I added those to the classpath. 

 

I am probably doing something stupid but I was wondering how to debug this issue? The log files do not seem to contain anything wrt this error which makes troubleshooting very difficult

 

All tips warmly welcomed!

 

Tx

 

Peter

DennisJaheruddi
Platinum ⭐️
December 24, 2019

This is quite a broad question and hard to troubleshoot all at once.

 

A general approach: 

 

1. Analyze your custom code and identify all bits of complexity/all dependencies

2. Run the standard example

3. Introduce in a very minimal fashion one complexity/dependency from your custom code into the standard

4. If it works, repeat step 3

 

This should allow you to narrow down exactly what is causing the problem (and hopefully guide the resolution).

- Dennis Jaheruddin If this answer helped, please mark it as 'solved' and/or if it is valuable for future readers please apply 'kudos'.

2 replies

DennisJaheruddi
Platinum ⭐️
Platinum ⭐️
December 24, 2019

This is quite a broad question and hard to troubleshoot all at once.

 

A general approach: 

 

1. Analyze your custom code and identify all bits of complexity/all dependencies

2. Run the standard example

3. Introduce in a very minimal fashion one complexity/dependency from your custom code into the standard

4. If it works, repeat step 3

 

This should allow you to narrow down exactly what is causing the problem (and hopefully guide the resolution).

Translate
- Dennis Jaheruddin If this answer helped, please mark it as 'solved' and/or if it is valuable for future readers please apply 'kudos'.
peter_coppens
Gold ⭐️
December 24, 2019

Hello,

Tx for your reaction Dennis. I was able to continue. 

The reason I was having issues seemed to be related to the fact that the Groovy script was a standard class with a static main method. It makes sense that Nifi does not accept that I guess, but the process of diagnosing such issue might be made easier imo. It was a trial and error task, and as you suggested, by starting from an example.

Anyway, I am good now 🙂

Regards

Peter

Translate