How to add custom listener groovy class for Script Runner plugin

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 votes
Henning Tietgens Community Champion Feb 05, 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.

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 Community Champion Feb 05, 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

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 Community Champion Feb 06, 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.

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?

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,164 views 13 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot