Could not find class

Tomas Novacek March 5, 2015

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
Answer accepted
Tomas Novacek March 5, 2015

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.

0 votes
Aaron Pascoe June 22, 2015

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