Script runner error updating script in script listener console.

RamamandA August 25, 2014

Hi,

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!

Rama

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

1 vote
Aaron Pascoe June 22, 2015

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.

1 vote
Marc Minten _EVS_
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.
March 17, 2015

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)

1 vote
Marc Minten _EVS_
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.
March 16, 2015

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

BUT !!!!!! AFTER SOME CHANGES AND "UPDATE" OF THAT SAME LISTENER I GOT THAT ERROR MESSAGE AGAIN !!!

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
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.
March 16, 2015

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

1 vote
Thomas Oeding November 4, 2014

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
0 votes
Marc Minten _EVS_
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.
March 17, 2015

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)
    @Override
    void workflowEvent(IssueEvent event) {     
	log.setLevel(org.apache.log4j.Level.DEBUG)
        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...)

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.
March 17, 2015

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

Marc Minten _EVS_
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.
March 17, 2015

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

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.
March 17, 2015

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

Marc Minten _EVS_
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.
March 17, 2015

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

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.
March 18, 2015

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

0 votes
Marc Minten _EVS_
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.
March 16, 2015

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 ?

0 votes
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.
August 26, 2014

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?

Thomas Oeding November 4, 2014

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events