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

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

Accepted Answer
2 votes

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.

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.

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).

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

82 views 0 4
Join discussion

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