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

1 vote
Accepted answer

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
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,513 views 15 20
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