Groovy Custom Listener gets error: Cannot open URL: bundle://186.0:0/null

MASI Mégalis Bretagne July 29, 2015

Hello there,

I've been trying to find a solution on this one for hours but I'm stuck. So I think it's time I ask for help! I tried to find information and I did a lot of google search but I couldn't figure it out.

So, here is what I'm trying to achieve:
I'm setting up a HelpDesk environnement using a combination of JIRA, JEMH, Automation Plugin, Script Runner plugin (Jira Service Desk doesn't suit our needs for a couple of important reasons). Now, I would like HelpDesk people to be able to send emails to customers when they add a comment to an issue. Which I managed to do. But what I want, is to send an email only when the comment's visibility is set to a specific role.
JEMH allows us to do the opposite. I can set it so that all comment's visibility roles fire an email sending but a specific role.

So I'm trying to find a workaround. I want to create a Custom Script Listener based on a groovy class that listens to the "Issue Commented" event. The listener checks if the comment's visibility is supposed to fire an email to the user or not. If so, it fires a custom event that the JEMH plugin listens to. Then the JEMH plugin sends the correct email when this custom event is fired.
I cannot do this with the built in listener "Fires an event when condition is true" nor with the Automation Plugin because I need to forward the comment attached to the "Issue Commented" event to my Custom Event so that JEMH can send it to the customer.

The issue:
So I wrote a groovy class, I put it on the JIRA server but when I create the Custom Script Listener in JIRA GUI, I get the error message :
"Problem loading class/script: groovy.util.ResourceException: Cannot open URL: bundle://186.0:0/null"

Relevant information:

The groovy class is

package megalis

import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.issue.IssueEventManager
import com.atlassian.jira.event.type.EventType
import groovy.util.logging.Log4j
import org.apache.log4j.Level

@Log4j
public class FireEnvoyerMailUsager extends AbstractIssueEventListener{

    @Override
    void workflowEvent(IssueEvent event) {

        log.setLevel(Level.DEBUG)

        if (event.eventTypeId == EventType.ISSUE_COMMENTED_ID && event.getComment()) {
            def issue = event.issue
        def comment = event.getComment()
        if (comment.getRoleLevelId() == (long)10201 ){
            IssueEventManager.dispatchEvent((long)10004, issue, event.getUser(), event.getComment(), null, null)
                log.debug("Evenement Commentaire externe declenche avec pour commentaire: ${event.getComment()}")
            }
        }
    }
}


I put this class on the server under /opt/atlassian/jira/atlassian-jira/WEB-INF/classes/megalis/FireEnvoyerMailUsager.groovy

In the Custom Listener screen, in the "Name of groovy class" field, I set : megalis.FireEnvoyerMailUsager


I'm not sure but could it possibly be related to https://ecosystem.atlassian.net/browse/UPM-5035 or my version of the Atlassian Universal Plugin Manager ?

Our environnement:
JIRA - v6.3.13 (standalone)
Adaptavist Script Runner - 3.1.3
JEMH - 1.6.71
Atlassian Universal Plugin Manager - 2.18.4


I hope I'm not asking a question that has already been solved many times, but I really couldn't find the solution until now.

Regards,

 

3 answers

1 accepted

2 votes
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 29, 2015

You should put it under <jira.home>/scripts, in your megalis directory, not in the installation directory.

I was under the impression that SD comments didn't use the role level, although I haven't had time to check that out, and it seems a bit unlikely anyway.

0 votes
MASI Mégalis Bretagne July 29, 2015

Thanks you! I wasn't aware that jira_home was different from jira_install. Now my class is loaded and I can debug it to make it work.

Indeed, I don't think SD uses the role level. But we don't use SD at all because of some of it's limitations (mainlyhttps://jira.atlassian.com/browse/JSD-1473, https://jira.atlassian.com/browse/JSD-218).

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 29, 2015

sorry, I ignored the bit where you said you *weren't* using JSD.

0 votes
MASI Mégalis Bretagne July 29, 2015

So I'm re-reading this post : https://answers.atlassian.com/questions/13415437. I'm wondering if the "null" part could come from a plugin.script.roots variable that wouldn't be set at all. I'm gooing to check that.

Suggest an answer

Log in or Sign up to answer