Invalid duplicate class definition of class

Paresh Gandhi
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.
October 9, 2014

Problem loading class: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: /var/atlassian/application-data/jira/scripts/com/icg/UpdateSummary.groovy: 9: Invalid duplicate class definition of class UpdateSummary : The sources /var/atlassian/application-data/jira/scripts/com/icg/UpdateSummary.groovy and file:/var/atlassian/application-data/jira/scripts/com/icg/UpdateSummary.groovy each contain a class with the name UpdateSummary. @ line 9, column 1. class UpdateSummary extends AbstractIssueEventListener

3 answers

0 votes
Mukesh Saran November 6, 2014

Rename the file to some other name, dont keep class name and file name same ! will solve the problem.

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.
October 9, 2014

It's generally because you have a class with code outside the class, so the compiler generates a class for the class in the file, and a script class with the same name, eg this will cause it if a file called Foo.groovy.

class Foo {}

new Foo()
Paresh Gandhi
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.
October 9, 2014

I don't have anything new Class_Name() in the file. This is working without any issue on 6.2 & script listner 2.1.17 When I did upgrade on staging, this issue started. I have copied my groovy files from /opt/... to /var/... I was able to update those successfully if I do Jira restart. However if i try to do update script runner files next day, it throws same error.

Paresh Gandhi
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.
October 9, 2014

I'm using below line- Logger log = Logger.getLogger(AddReporterAsWatcher.class) I hope this will not cause any issue. Do i need to delete files from old path?

Paresh Gandhi
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.
October 9, 2014

also if i keep those files under /var/atlassian/applicaiton-data/jira/scripts it does not throw mentioned. as of not those i are kept in /var/atalassian/applicaiton-data/jira/scripts/com/icg/

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.
October 12, 2014

It depends what the package name in the class is... what is it? They should only be there once in the script root.

Pareshkumar Gandhi October 30, 2014

more details>> restart jira >> add/update custom listner files >> no duplicate class error create a jira issue which meets condition in the class file now again >> add/update custom listner files >> duplicate class name error if i do restart then it does not throw error conditionally ticket has not been created after restart

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.
October 30, 2014

> Do i need to delete files from old path? Probably, yes.

Pareshkumar Gandhi October 30, 2014

that did not help.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 9, 2014

Do you have any links on the file or is it duplicated in some way?  Has the file got the same class named twice?

Suggest an answer

Log in or Sign up to answer