How to add custom listener groovy class for Script Runner plugin

Rohan Sakhale February 5, 2014

Hello guys,

I know this question is quite childish, but we have been searching over net for getting this done but didn't get any appropriate solution and we are still stuck on adding Custom Listener as external file into Jira

Steps we did, created a Groovy class and pasted it in ../WEB-INF/classes/PACKAGEPATH

Also, we tried compiling this groovy class and pasted it on above location

Server was restarted after both the above steps, still have no effect

Can anyone please help us out in our first step

Thanks in advance for your support

1 answer

1 accepted

1 vote
Answer accepted
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 5, 2014

You have to add a script listener and include the package path while providing the "Name of groovy class" (so it's "PACKAGEPATH.YourListener"). No restart needed.

Rohan Sakhale February 5, 2014

Thanks Henning for the answer, adding a script listener and the package path is the second step, but before that we have to add the groovy file, right? We are stuck on deployment of the groovy file on proper location which will be loaded in JVM that could be used as Script Listener using the full class path.

What is the location for deployment of this groovy file or groovy's class file?

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 5, 2014

It's like you wrote ../WEB-INF/classes/PACKAGEPATH.

So if your package is com.sakhale.groovy the file should be here

../WEB-INF/classes/com/sakhale/groovy/YourListener.groovy

Rohan Sakhale February 5, 2014

Henning, I have already tried this but it didn't seem to work.

Do we need to re-build the jar/war or something?

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 6, 2014

No. Are you sure about the writing of your package and class names? It's case sensitive. After adding the script listener you should take a look into the log, to see if there are any error messages while the script runner tries to load the listener class.

Rohan Sakhale February 13, 2014

Hi Henning,

After adding the groovy file on that location, I am getting ClassNotFoundException for GroovyObject, check below

Referer URL: http://localhost:2990/jira/secure/admin/groovy/CannedScriptListener.jspa?cannedScript=com.onresolve.jira.groovy.canned.workflow.listeners.CustomListener&atl_token=BMT7-7PUT-AYWX-I98G|1f48e45d5de7e253a474d71331955bdae3adca9f|lin

java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
 
Can you help me understand the reason behind this? and solution we can overcome this?
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2014

Suggest an answer

Log in or Sign up to answer