Script runner error updating script in script listener console.


I created a script to update issue and added it to script listener for Jira 6.3. I maed some changes to the script and the script is working fine and is updating issue as expected. But if I go to the script listener console and hit update button I see following error. Not sure what am I missing here. The update works fine in Jira 6.2. Thanks for your help!


Problem loading class: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: D:\Atlassian\Application Data\JIRA\scripts\listener\UpdateIssue.groovy: 22: Invalid duplicate class definition of class com.custom.SetDefaultFields : The sources D:\Atlassian\Application Data\JIRA\scripts\listener\UpdateIssue.groovy and file:/D:/Atlassian/Application%20Data/JIRA/scripts/listener/UpdateIssue.groovy each contain a class with the name com.custom.SetDefaultFields. @ line 22, column 1. class SetDefaultFields extends AbstractIssueEventListener { ^ 1 error

7 answers

Same error here, i can't update an existing script listeners:

Problem loading class: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: D:\Program Files (x86)\Atlassian\Application Data\JIRA\scripts\com\3ds\UpdateField.groovy: 44: Invalid duplicate class definition of class UpdateField : The sources D:\Program Files (x86)\Atlassian\Application Data\JIRA\scripts\com\3ds\UpdateField.groovy and file:/D:/Program%20Files%20(x86)/Atlassian/Application%20Data/JIRA/scripts/com/3ds/UpdateField.groovy each contain a class with the name UpdateField. @ line 44, column 1. class UpdateField extends AbstractIssueEventListener { ^ 1 error

@Jamie Echlin [Adaptavist]

I did some more trial : clearing the JIRA or script cache did not solve.

Removing the Listener definition and recreating it did not solve: still the same error.

Stopping and restarting JIRA did solve the problem. I could load again the Listener.


This is unworkable! Could you please indicate what could be wrong ?

Error :

Problem loading class: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: D:\JiraDev\Distibution\Data\scripts\EpicStatusListener.groovy: 16: Invalid duplicate class definition of class EVSListeners.EpicStatusListener : The sources D:\JiraDev\Distibution\Data\scripts\EpicStatusListener.groovy and file:/D:/JiraDev/Distibution/Data/scripts/EpicStatusListener.groovy each contain a class with the name EVSListeners.EpicStatusListener. @ line 16, column 1.    class EpicStatusListener extends AbstractIssueEventListener {    ^
1 error

Can you post the code up somewhere? What version are you using?

Some more info:

I THINK warning it is somewhat related with having (groovy) errors in the script. In fact I am migrating from JIRA 6.1 and the Listener script returned some groovy script errors, I am trying to solve  .

If I reduce the script to something that works, I stop and restart Jira, I can then modify the script and reload it as many times I wish. When I introduce an error, when (re)loading the script for the custom Listener, he gives the (correct) groovy error. I correct the error, re-load the script. Still Ok. When I then (EVEN WITHOUT changing something in the script), re-load again, I get the above error sad sad. Very strange .... But VERY annoying (have to stop and restart JIRA to solve sad)

I also am having this problem.


Basically I have made a script listener.  I map it to specific events and everything is working as intended, but then I notice that I need to update my listener to a different event.  I try to update the listener and I receive the error mentioned above.

My only workaround is to either restart JIRA or rename the script listener/class.

0 vote

This is expected. You cannot run classes in the script console, just scripts.

When running a script you get a synthetic class corresponding to the name of the file. In your case you also get a class for the class contained in the script, hence duplicate class definition.

It doesn't make sense to "run" a class in the script console, it has no "main" method so which method would you expect to be called, with which parameters?

We don't run the script. We want to update an existing script listener...

I face the same problem (JIRA 6.3.12, script plugion 3.0.7). I made some changes to the listener script, the update worked fine for soem time, and then suddenly we got the "Invalid duplicate class" error, indicating "The sources xxxx and file:/xxxx contain ..." (where the xxx-es are identical)

Did someone found the cause, or how to go further ? Reboot JIRA sadsad ?

JIRA : 6.3.12
Scriipt Runner : 3.0.7

In fact we are migrating to JIRA 6.3. I reduced the listener script to the very minimum to test it; heres the code :

package EVSListeners;
import com.atlassian.jira.event.issue.AbstractIssueEventListener; 
import com.atlassian.jira.event.issue.IssueEvent; 
import org.apache.log4j.Logger;
class EpicStatusListener extends AbstractIssueEventListener {
    Logger log = Logger.getLogger(EpicStatusListener.class)
    void workflowEvent(IssueEvent event) {     
        log.debug "Listener :  started"
        log.debug "   Event (workflowEvent): ${event.getEventTypeId()} fired for ${event.issue} and caught by EpicStatusListener"

But I wonder the code in the listener is the cause. I can make changes, Upload the (changed) Listener script, and then suddenly (after 3 or 4 changes), I get the error above.

When I remove the Custom Listener, and then create one again, he also returns this error. It seems for some reason he gets stuck with previous class definitions he does not clean up properly...

Note that in the error message the sources are once named "D:\JiraDev..." and the other one "file:/D:/JiraDev..." (the extra "file:/" and the slashes versus backslashes...)

Could you format that using the {code} macro? It's unreadable as it is.

Sorry, hope this is more clear... :-)

that's much better... I can't immediately see what the error you mention below is.... > related with having (groovy) errors in the script

Jamie, in the script above itself is no error. I get an error when UPLOADING the script, even if there is no error in the script. As explained below, I think that problem is triggered by having groovy errors in a previous Upload (my actual Listener script is much longer, I am debugging it..). But again, I think it has nothing to do with the actual contents of the script: if I stop and restart Jira, I can Upload the script without problem....

I'm not quite sure what you mean by "uploading" the script... can you describe more?

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
Bridget Sauer
Published Thursday 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...

359 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