Could not find class

Hi Jamie,

I have written a groovy listener and trying to add it as Script Listener. I already have my .groovy file in attlasian-jira/WEB-INF/classes/com/nju/jira/listeners - according to package defined in groovy file.

I've read all discusion bellow the Listeners article here https://jamieechlin.atlassian.net/wiki/display/GRV/Listeners

and it seems my problem is different from others. First I've tried to write my class directly to the class name field, then i tried to write com.onresolve.jira.groovy.listener.GroovyListener in and then com.onresolve.jira.groovy.listener.ExampleListener as you suggest as a first attempt. All results in the same 

Could not find class, check it is under a 'scripts directory': java.lang.ClassNotFoundException: com.onresolve.jira.groovy.listeners.ExampleListener

I have no idea what 'script directory' is. I ve searched all JIRA directory and there is no Scripts directory. 

Thanx much, Tom

here is the snippet of my class 

package com.nju.jira.listeners

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.IssueManager
import org.apache.log4j.Category

public class CommentCopyListener extends AbstractIssueEventListener {
	Category log = Category.getInstance(CommentCopyListener.class)
	@Override
    void workflowEvent(IssueEvent event) {
  
		//my functionality here

	}
}

2 answers

1 accepted

Hi there,

I solved this. Problem was that I copied my .groovy file to WEB-INF/classes (according to 3 years old article)

In nowadays version of Script Runner, the script has to be in /var/atlassian/application-data/jira/scripts + package folders. 

Now it works, I have my Listener running.

As a side note here, if you don't know what directory to put your scripts, just look at the script console screen and it tells you exactly where it is expecting the script.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

91 views 0 1
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