Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:



I wrote a Scriptrunner postfunction that initially tries to identify the request type of a service desk ticket and then depending upon the type, performs further actions.

I was able to run the code both inline and as file script before I upgraded to 7.4.4 and now I keep getting the folllowing error when running the script either inline or via file... I can't seem to understand why it is complaining of initialization when from what I can see, it's not being initialized...Please advise...

"org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during semantic analysis: Cannot set plugin module when field already initialised
java.lang.Exception: Cannot set plugin module when field already initialised
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
... 1 filtered
at java.lang.reflect.Constructor.newInstance(
at org.codehaus.groovy.reflection.CachedConstructor.invoke(
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(

For reference, here is my code
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.util.IssueChangeHolder
import com.atlassian.jira.util.JiraUtils
import com.atlassian.jira.workflow.WorkflowTransitionUtil
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl
import com.atlassian.servicedesk.api.requesttype.RequestTypeService
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import org.apache.log4j.Level
import org.apache.log4j.Logger

* This script enables automatic routing of such service desk requests that need to bybass service fulfillment review.
* The business rule to identify those requests is defined as a default value for custom field 13100.
* Created by SrivastavaA on 8/14/17.


RequestTypeService requestTypeService

def log = Logger.getLogger("scriptrunnerconsole")

// String Constants
final String GENERAL_INQUIRIES = "General Inquiries"
final String ACCOUNTS_AND_ACCESS = "Accounts and Access"
final String PORTAL = "Portal"
final String PHONES_AND_MOBILE_DEVICES = "Phones and Mobile Devices"
final String TECHNICAL_STAFF_REQUESTS = "Technical Staff Requests"
final String COMPUTERS = "Computers"
final String FILE_TRANSFERS_AND_PRINTING = "File Transfers and Printing"
final String ASSET_MANAGEMENT = "Asset Management"
final String POLICY_AND_SECURITY = "Policy and Security"
final String SOFTWARE = "Software"

final String BUSINESS_RULES_CUSTOM_FIELD_ID = "customfield_13100" //SD Request Routing Business Rules
final String ASSIGNED_JIRA_OPERATIONS_GROUP = "customfield_13101" //Assigned JIRA Operations Group
final String SD_REQUEST_AUTOMATION_TYPE = "customfield_13102" //SD Request Automation Type

final String NG_APPS = "NotificationGroup - Applications";
final String NG_BTSG = "NotificationGroup - Business Technology Support";
final String NG_COMM = "NotificationGroup - Communications";
final String NG_DB = "NotificationGroup - Data";
final String NG_DX = "NotificationGroup - DX";
final String NG_ERP = "NotificationGroup - ERP";
final String NG_NETWKS = "NotificationGroup - Networks";
final String NG_DBO = "notifyGroup-DBOperations";

//Get Issue Object
Issue issue = issue //The issue is internally retrieved in the post-function
log.debug("Issue Key = " + issue.key)

try {
//Get Customer Request Type for Issue
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def requestType = requestTypeService.getRequestTypeForIssue(currentUser, issue).right().get()
def requestTypeName = requestType.getName()
log.debug("Request Type Name = " + requestTypeName)

//Get instance of Custom Field Manager
def customFieldManager = ComponentAccessor.getComponent(CustomFieldManager)

//Get Default Value for the Automation Business Rules Custom Field
def businessRulesObject = customFieldManager.getCustomFieldObject(BUSINESS_RULES_CUSTOM_FIELD_ID)

def fieldConfig = businessRulesObject?.getRelevantConfig(issue)
def businessRulesFieldType = customFieldManager.getCustomFieldTypes().find { == "Text Field (multi-line)" }
def businessRules = businessRulesFieldType?.getDefaultValue(fieldConfig)
log.debug("Business Rules = " + businessRules.toString())

//Setup hashmap to store business rules
HashMap svcReqType2GroupMap = new HashMap<>()

String[] busRulesDefValArray = businessRules.toString().split(";")
log.debug("busRulesDefValArray SIZE = " + busRulesDefValArray.size())

for (int x = 0; x < busRulesDefValArray.size(); x++) {
String[] keyValueArray = busRulesDefValArray[x].split("[|]");
List keyValueArrayList = Arrays.asList(keyValueArray)
svcReqType2GroupMap.put(keyValueArrayList.get(0).trim(), keyValueArrayList.get(1).trim())

log.debug("svcReqType2GroupMap SIZE = ${svcReqType2GroupMap.size()}")

def getKeyValuePair = svcReqType2GroupMap.get(requestTypeName)
log.debug("The Key-Value Pair is = ${getKeyValuePair.toString()}")

String[] splitValues = getKeyValuePair.split(":")
def groupName = splitValues[0].trim().substring(1, (splitValues[0].trim().length() - 1))
def routingInstruction = splitValues[1].trim()

//Initialize variables to setup group picker & automation type custom field value
def groupManager = ComponentAccessor.getGroupManager()
def singleGroupCf = customFieldManager.getCustomFieldObject(ASSIGNED_JIRA_OPERATIONS_GROUP)
def automationTypeCF = customFieldManager.getCustomFieldObject(SD_REQUEST_AUTOMATION_TYPE)

return svcReqType2GroupMap.size()

@Looking for some guidance please@Adaptavist Supp @Jamie Echlin _Adaptavist_@Thanos Batagiannis _Adaptavist_


1 answer

1 accepted

Hi Anupam,

Questions like these are better suited for our support portal. We monitor our support portal continuously for problems with the plugin.

To answer your question: I believe you are experiencing a rather recent bug. SRJIRA-2388 causes @PluginModule to not correctly load classes.

The workaround is to replace @PluginModule with something like this:

RequestTypeService requestTypeService = ScriptRunnerImpl.getPluginComponent(RequestTypeService)

And you'll need this import:

import com.onresolve.scriptrunner.runner.ScriptRunnerImpl

Thanks Joshua for both answering the question and pointing me to your support portal. 


Let me give that a try and will update you shortly. :)

That worked. Thanks!!!

Glad to hear that it worked! If you wouldn't mind, please select my answer as the accepted answer so that others can see the solution more easily.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

92 views 0 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you