ClassCastException when executing automation rules

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

When competing automation add-ons ("Apps") are installed, automation actions fail to execute.

Diagnosis

Automation rules fail to execute, and the following exception maybe be shown in the UI, and also logged to that atlassian-jira.log file. In the examples below, "ScriptRunner" is listed as the automation component, however that could be any other third party plugin.

UI

1 java.lang.ClassCastException: class com.onresolve.scriptrunner.automation.ExecuteScriptIssueActionV2 cannot be cast to class com.codebarrel.automation.api.thirdparty.AutomationRuleComponent

Log file

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2022-08-29 16:25:34,906+0000 automation-rule-executor:thread-6 ERROR whispy [c.c.a.api.service.ComponentChainImpl] Unexpected runtime error executing component for config 'ComponentConfigBean{id='144', component=ACTION, parentId='null', conditionParentId='null', schemaVersion=1, type='jira.issue.comment', value=CommentActionConfig{comment='SNIP', publicComment=false, commentVisibility=null, sendNotifications=true, addCommentOnce=true, useLegacyRendering=false}, conditions=[], children=[], optimisedIds=[]}': com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.ClassCastException: class com.onresolve.scriptrunner.automation.ExecuteScriptIssueActionV2 cannot be cast to class com.codebarrel.automation.api.thirdparty.AutomationRuleComponent (com.onresolve.scriptrunner.automation.ExecuteScriptIssueActionV2 is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @6609a68e; com.codebarrel.automation.api.thirdparty.AutomationRuleComponent is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @101af670) at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149) at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112) at com.atlassian.util.concurrent.ResettableLazyReference.get(ResettableLazyReference.java:92) at com.codebarrel.jira.plugin.automation.template.JiraTemplateRendererContextProviderFactory.getContextProviders(JiraTemplateRendererContextProviderFactory.java:98) at com.codebarrel.automation.rulecomponent.jira.common.renderer.IssueInputSubstitutionRenderer.compile(IssueInputSubstitutionRenderer.java:153) at com.codebarrel.automation.rulecomponent.jira.common.renderer.LegacySwitchingRendererImpl.compile(LegacySwitchingRendererImpl.java:32) at com.codebarrel.automation.rulecomponent.jira.action.comment.CommentActionExecutor.executeWithIssues(CommentActionExecutor.java:67) at com.codebarrel.automation.api.component.executor.IssueRequiredExecutor.execute(IssueRequiredExecutor.java:34) at com.codebarrel.automation.api.component.executor.IssueRequiredExecutor.execute(IssueRequiredExecutor.java:17) at com.codebarrel.automation.api.service.ComponentChainImpl.doExecute(ComponentChainImpl.java:75) at com.codebarrel.automation.api.service.SingleRuleExecutorServiceImpl.execute(SingleRuleExecutorServiceImpl.java:228) at com.codebarrel.jira.plugin.automation.queue.JiraAutomationQueueExecutor.lambda$null$3(JiraAutomationQueueExecutor.java:268) at com.codebarrel.jira.plugin.automation.service.execution.JiraThreadLocalExecutor.lambda$executeAs$0(JiraThreadLocalExecutor.java:37) at com.codebarrel.jira.plugin.automation.service.execution.JiraThreadLocalExecutor.executeAsWithResult(JiraThreadLocalExecutor.java:67) at com.codebarrel.jira.plugin.automation.service.execution.JiraThreadLocalExecutor.executeAsWithResult(JiraThreadLocalExecutor.java:53) at com.codebarrel.jira.plugin.automation.service.execution.JiraThreadLocalExecutor.executeAs(JiraThreadLocalExecutor.java:36) at com.codebarrel.jira.plugin.automation.queue.JiraAutomationQueueExecutor.lambda$processClaimedItem$4(JiraAutomationQueueExecutor.java:268) at com.atlassian.jira.util.concurrent.BoundedExecutor$1.run(BoundedExecutor.java:50) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.lang.ClassCastException: class com.onresolve.scriptrunner.automation.ExecuteScriptIssueActionV2 cannot be cast to class com.codebarrel.automation.api.thirdparty.AutomationRuleComponent (com.onresolve.scriptrunner.automation.ExecuteScriptIssueActionV2 is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @6609a68e; com.codebarrel.automation.api.thirdparty.AutomationRuleComponent is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @101af670) at com.codebarrel.jira.plugin.automation.thirdparty.ThirdPartyComponentModuleDescriptor.getModule(ThirdPartyComponentModuleDescriptor.java:51) <SNIP>

Cause

Multiple automation apps registered under the same class are present. This overrides the Automation for Jira add-on's abillity to interact with third party automation components.

It isn't recommended to have more than 1 "Automation for Jira" style app installed.

Solution

If you have Automation for Jira installed and licensed, but don't need the others, remove the following plugins if installed:

  • Automation Lite for Jira

  • Automation Module

  • JIRA Automation SPI

If you have Automation for Jira lite installed and licensed, but don't have a need for the others, remove the following plugins if installed:

  • Automation for Jira

  • Automation Module

  • JIRA Automation SPI

To remove a plugin:

  1. Click the Jira Administration "cog" icon in the top right hand corner of Jira

  2. Select Manage Apps

  3. From the drop-down list, choose "All Apps"

  4. Locate the app you wish to remove from the list then click Uninstall

  5. Once you have removed all the plugins, you may need to restart the Jira service on all nodes for the correct Automation plugin to become re-registered

Updated on June 5, 2024

Still need help?

The Atlassian Community is here for you.