ScriptRunner : Getting NoClassDefFoundError for GroovyObject


In continuation with the problem asked previously for adding custom listener as a groovy class

We were still not able to figure out the proper solution as now we are getting NoClassDefFoundError for [CannedScriptListener]:groovy/lang/GroovyObject

Have also referred to by Jamie and we don't see any groovy jar in the lib's

Also we noticed that script runner engine is " Groovy (Groovy Scripting Engine, version: 2.0, registered extensions: [groovy])" and if we run the following code


the output seen is 1.8.5

Can you please help figure out what we are missing out here and help us run our Custom Listener.

Thanks for your support in advance

6 answers

1 accepted

1 vote
Accepted answer
Henning Tietgens Community Champion Feb 20, 2014

You have to place your script under WEB-INF/classes/com/abc/jira/scriptrunner/scripts/IssuePostUpdateListener.groovy and import that as

Did you?

And there a some other things:

  • import org.apache.log4j.Category is missing
  • Collection<MutableIssue> subTaskList = issue.getSubTaskObjects() could be a problem, because it returns Collection<Issue>

I have placed groovy file on the same location, I had ran this script on groovy console and no error's were found

I have updated the MutableIssue to regular Issue and have also added the import line

But still I get same error


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

java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
Henning Tietgens Community Champion Feb 20, 2014

Which version of Script Runner and JIRA do you use? Did you add the listener as Script Listener->Custom Listener or as Listener?

On my local machine both Jira (6.1.x) & Script Runner (2.1.16) are running on latest version.

Yes, I added as Script Listener > Custom Listener.

Also, I tried removing the plugin and re-installing again, nothing helped.

Are we supposed to add additional groovy jar that contains this class object?

Henning Tietgens Community Champion Feb 20, 2014

You shouldn't have to install any additional jar. I don't have another idea what could lead to the error message.

Thanks Henning for all your valuable comments, the CustomListener is finally @Work:)

Henning Tietgens Community Champion Mar 05, 2014

It would be nice if you share here how you solved your problem. Maybe sometime someone has the same problem...

The problem was solved by removing .class file from the /WEB-INF/classes and just keeping .groovy file and secondly if you see my code above, there was a mistake made in class name provided for Logger which was named previously and class name later changed was pending to be changed in Logger which gave NoClassDefError. That was certainly manual mistake which led for so much trouble in understanding it, but finally it sounds so cool after this is being solved.

Thanks for your help Henning :)

Can you please post the entire line of log which contains 'NoClassDefFoundError'. I think it should contain the class name it has been looking for.

Hi Sameera,

Following is seen while trying to add custom listener

Could not execute action [CannedScriptListener]:groovy/lang/GroovyObject

java.lang.NoClassDefFoundError: groovy/lang/GroovyObject at java.lang.ClassLoader.defineClass1(Native Method)

0 votes
Henning Tietgens Community Champion Feb 20, 2014

Could you please post your listener source (if it's sensible information delete some parts but don't change the structure of the script), where it's installed, how it's configured in Script Runner and the complete exception stack trace?

Hi Henning,

Here is the Listener source code used


import java.util.Collection
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.UserUtils

class IssuePostUpdateListener extends AbstractIssueEventListener{
	Category log = Category.getInstance(PostUpdationListener.class)
	void workflowEvent(IssueEvent event){
		IssueManager issueManager = ComponentAccessor.getIssueManager()
		CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()

		Issue issue = event.getIssue()

		CustomField qeLeadCF = customFieldManager.getCustomFieldObjectByName("QE Lead")

		ApplicationUser qeLeadVal = (ApplicationUser) issue.getCustomFieldValue(qeLeadCF)

		Collection&lt;Version&gt; versionList = issue.getFixVersions()

		Collection&lt;MutableIssue&gt; subTaskList = issue.getSubTaskObjects()

		for (MutableIssue mi in subTaskList) {
			 if (mi.getIssueTypeObject().getName().equals("QA Sub-task")) {
				Issue updatedIssue = issueManager.updateIssue(issue.getReporter(), mi,EventDispatchOption.ISSUE_UPDATED, false)        
				assert updatedIssue.getCustomFieldValue(qeLeadCF).equals(qeLeadVal)
				assert updatedIssue.getAssigneeUser().equals(qeLeadVal)

I have added this code in a groovy file and have placed the file as per the location you had said previously WEB-INF/classes

I am trying to add this class as a Custom Listener on event Issue Update for all projects

Below is the partial stack trace

Could not execute action [CannedScriptListener]:groovy/lang/GroovyObject
java.lang.NoClassDefFoundError: groovy/lang/GroovyObject at
java.lang.ClassLoader.defineClass1(Native Method) at
java.lang.ClassLoader.defineClassCond(Unknown Source) at
java.lang.ClassLoader.defineClass(Unknown Source) at Source) at
org.apache.catalina.loader.WebappClassLoader.findClassInternal( at
org.apache.catalina.loader.WebappClassLoader.findClass( at
org.apache.catalina.loader.WebappClassLoader.loadClass( at
java.lang.ClassLoader.loadClass(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) at

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,436 views 15 19
Read article

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