Script Listener not working

I'm trying to setup a simple Script Listner but I always get

Problem loading class: groovy.lang.MissingMethodException: No signature of method: static groovy.lang.Category.getInstance() is applicable for argument types: (java.lang.Class) values: [class softsolution.OrgGroupListener]

I found this thread where it seems to work:  https://answers.atlassian.com/questions/12917257 .

I put my OrgGroupListener.groovy file under

/var/atlassian/application-data/jira/scripts/softsolution

Name of groovy class: softsolution.OrgGroupListener

Also if i remove Category in the script i sill the the above error

 

Here is my listener

 

package softsolution

 

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 OrgGroupListener extends AbstractIssueEventListener {

    Category log = Category.getInstance(OrgGroupListener.class)

    

    @Override

    void workflowEvent(IssueEvent event) {

 

        //my functionality here

 

    }

}

 

 

 

 

1 answer

1 accepted

I've updated scirpt runner to newest version and restarted JIRA => now it works.

BTW I had to update my simple listener (see below).

 

package softsolution;

 

import com.atlassian.jira.event.issue.*;

import org.apache.log4j.Category;

 

public class OrgGroupListener extends AbstractIssueEventListener {

    Category log = Category.getInstance(OrgGroupListener.class)

    

    @Override

    void workflowEvent(IssueEvent event) {

        log.setLevel(org.apache.log4j.Level.DEBUG);

        log.debug ("SGD Event: ${event.getEventTypeId()} fired for ${event.issue} and caught by ExampleListener");

        //my functionality here

 

    }

}

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published Apr 19, 2018 in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

366 views 0 6
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