Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

startup failed: Script1.groovy: 2: unable to resolve class com.atlassian.jira.issue.fields.screen.Fi

Brian Shumaker July 12, 2022

I am attempting to run a script in Power Groovy - Script Launcher that will Delete Screen Schemes not used by any Issue Type Screen Schemes:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.screen.FieldScreenSchemeManager

def fssm = ComponentAccessor.getComponent(FieldScreenSchemeManager.class)
def itssm = ComponentAccessor.issueTypeScreenSchemeManager

def sb = new StringBuffer()

sb.append("Deleted screen schemes with no associated issue type screen schemes:\n")

fssm.fieldScreenSchemes.each { fss ->
 try {
  def itssCollection = itssm.getIssueTypeScreenSchemes(fss);

  // find field screen schemes that are still associated with deleted issues type screen schemes
  def allDeleted = true;
  itssCollection.each { itss ->
   if(itss != null) {
    allDeleted = false;
    return;
   } 
  }

  //remove field screen schemes with no (valid) associated issue type screen schemes
  if(itssCollection.size() == 0 || allDeleted == true) {
   //remove association to any screens
   fssm.removeFieldSchemeItems(fss);
   //remove field screen scheme
   fssm.removeFieldScreenScheme(fss);
   sb.append("${fss.name}\n");
  }

 }
 catch(Exception e) {
  //noop
  sb.append("Error: " + e + "\n");
 }
}

return "<pre>" + sb.toString() + "<pre>"

 

When attempting to run this script, I am getting the following error:

startup failed: Script1.groovy: 2: unable to resolve class com.atlassian.jira.issue.fields.screen.FieldScreenSchemeManager @ line 2, column 1. import com.atlassian.jira.issue.fields.screen.FieldScreenSchemeManager ^ 1 error

 

Looking into all the documentation that I can, I find that FieldSCreenSchemeManager is listed as an interface in the support documentation and is not deprecated anywhere that I can tell. Even in the latest  9.0.0 Jira documentation:

Package com.atlassian.jira.issue.fields.screen documentation has an interface for FieldScreenSchemeManager:

https://docs.atlassian.com/software/jira/docs/api/9.0.0/com/atlassian/jira/issue/fields/screen/FieldScreenSchemeManager.html

 

ComponentAccessor documentation also has FieldScreenSchemeManager:

https://docs.atlassian.com/software/jira/docs/api/9.0.0/com/atlassian/jira/component/ComponentAccessor.html#getFieldScreenSchemeManager-- 

 

So my question is, why is this not able to resolve this class/interface?

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Radek Dostál
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.
July 13, 2022

Hm, strange indeed.

 

Copy pasting your snippet and adding the getter both resolve the same object on 8.20.8:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.screen.FieldScreenSchemeManager

def fssm = ComponentAccessor.getComponent(FieldScreenSchemeManager.class)
def fssm2 = ComponentAccessor.getFieldScreenSchemeManager()

return fssm.toString() + "<br>" + fssm2.toString()
Result
com.atlassian.jira.issue.fields.screen.DefaultFieldScreenSchemeManager@1ec1cd1
com.atlassian.jira.issue.fields.screen.DefaultFieldScreenSchemeManager@1ec1cd1

 

Is this something persisting even after restarting Jira, and which version are you on?

 

Brian Shumaker July 13, 2022

Hello Radek, 

 

We are currently on Version 8.18.2. I am not an admin user on my device nor do I have access to the server that our Jira instance is hosted on, if you are referring to starting/stopping the whole Jira instance, so that isn't something I have tried yet...

Brian Shumaker July 18, 2022

Hello Radek, 

 

We are currently on Version 8.18.2. I am not an admin user on my device nor do I have access to the server that our Jira instance is hosted on, if you are referring to starting/stopping the whole Jira instance, so that isn't something I have tried yet...

TAGS
AUG Leaders

Atlassian Community Events