Hello,
I was using the custom listener function in JIRA 6.2 without problem.
Now I am evaluating the migration to JIRA6.4, and my listener won't work => nothing happens nor is logged in the catalina.out.
I'm using the scriptrunner version 3.1.4
My script is a groovy class that extends the AbstractIssueEventListener (like in most examples), and the file is on server in $JIRA_INSTALL/atlassian-jira/WEB_INF/classes/com/mycompany/jira/IssueEditedListener.groovy
package com.mycompany.jira.listeners import org.apache.log4j.Category import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.issue.ModifiedValue import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.util.DefaultIssueChangeHolder import com.atlassian.jira.issue.util.IssueChangeHolder import com.atlassian.jira.event.issue.AbstractIssueEventListener import com.atlassian.jira.event.AbstractEvent import com.atlassian.jira.event.issue.IssueEvent class IssueEditedListener extends AbstractIssueEventListener { Category log = Category.getInstance(IssueEditedListener.class) @Override void workflowEvent(IssueEvent event) { log.error "Event: ${event.getEventTypeId()} fired for ${event.issue} and caught by IssueEditedListener" [...some other code here...] } }
Now when I open my custom listener configuration in JIRA, if I enter the name of the class "com.mycompany.jira.listeners.IssueEditedListener" in the "Name of the goovy class" field, I end up with error:Problem loading class/script: groovy.util.ResourceException: Cannot open URL: bundle://165.0:0/null
(same error whatever I put in the field, in fact...)
What is wrong with the configuration? Again, it was working just fine with JIRA6.2.7 and scriptrunner 2.1.17.
Regards
Gael
You need to put it under a script root - and refer to it either as com.mycompany.jira.listeners.IssueEditedListener or com/mycompany/jira/listeners/IssueEditedListener.groovy
Further examples here: https://scriptrunner.adaptavist.com/latest/jira/listeners.html#_custom_listener_example
Thanks Jamie, this solved the issue. I saw the "Heritage" Custom Listeners section in https://scriptrunner.adaptavist.com/latest/jira/listeners.html#_custom_listener_example, but the point 2) talks about the script roots directory without pointing to the https://scriptrunner.adaptavist.com/latest/jira/#_script_roots Just adding the hyperlink would help a lot of people I think ;) Regards Gael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good point, will do. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I ran into a similar situation after upgrading ScriptRunner.
I used to be able to use the package name followed by the class name like you're attempting. Example: com.custom.MyListener
Now I have to put in the path followed by the file name. Example: ...../jira/scripts/com/custom/myListener.groovy
Try that, hope it helps. I'm interested to know if you get the package name approach to work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ran into this problem with my scripts folder too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.