Hi,
In continuation with the problem asked previously for adding custom listener as a groovy class https://answers.atlassian.com/questions/259127/how-to-add-custom-listener-groovy-class-for-script-runner-plugin
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 https://answers.atlassian.com/questions/107156/where-to-place-a-custom-listener-for-script-runner-version-2/107221answered 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
GroovySystem.getVersion()
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
You have to place your script under WEB-INF/classes/com/abc/jira/scriptrunner/scripts/IssuePostUpdateListener.groovy and import that as com.abc.jira.scriptrunner.scripts.IssuePostUpdateListener
Did you?
And there a some other things:
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
java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Which version of Script Runner and JIRA do you use? Did you add the listener as Script Listener->Custom Listener or as Listener?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You shouldn't have to install any additional jar. I don't have another idea what could lead to the error message.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Henning for all your valuable comments, the CustomListener is finally @Work:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It would be nice if you share here how you solved your problem. Maybe sometime someone has the same problem...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 java.security.SecureClassLoader.defineClass(Unknown Source) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Henning,
Here is the Listener source code used
package com.abc.jira.scriptrunner.scripts 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) @Override 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<Version> versionList = issue.getFixVersions() Collection<MutableIssue> subTaskList = issue.getSubTaskObjects() for (MutableIssue mi in subTaskList) { if (mi.getIssueTypeObject().getName().equals("QA Sub-task")) { mi.setFixVersions(versionList) mi.setAssignee(UserUtils.getUser(qeLeadVal.getUsername())) Issue updatedIssue = issueManager.updateIssue(issue.getReporter(), mi,EventDispatchOption.ISSUE_UPDATED, false) assert updatedIssue.getCustomFieldValue(qeLeadCF).equals(qeLeadVal) assert updatedIssue.getAssigneeUser().equals(qeLeadVal) } } } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.