All Groovy scripts stored in Insight suddenly stopped working with ClassCastException


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

All Groovy scripts stored in Insight suddenly stopped working with ClassCastException. This affects all Groovy scripts in Insight automation rules and post functions, as well as testing a simple script using Insight script console.

Environment

Any Insight version

Diagnosis

Any attempt to run a Groovy script with Insight will fail with exception like the following.

From the Insight script console
Error: GroovyInsightException: Failed to create Script instance for class: class Script1. Reason: java.lang.ClassCastException: Script1 cannot be cast to groovy.lang.GroovyObject'
insight_automation.log
2021-07-30 13:56:34,300 [insight-event-6] | AutomationRuleGroovyScriptAction, Unexpected error: Failed to create Script instance for class: class automation.ticketUpdate. Reason: java.lang.ClassCastException: automation.ticketUpdate cannot be cast to groovy.lang.GroovyObject
groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class automation.ticketUpdate. Reason: java.lang.ClassCastException: automation.ticketUpdate cannot be cast to groovy.lang.GroovyObject

Cause

The Java class loading under Jira OSGi trying to find the same Groovy object class under 2 different paths. 

Solution

A Jira restart should solve the issue






Last modified on Nov 26, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.