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

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

ScriptRunner - problem after upgrade to 5.1

Hi, i have a problem with the script runner and @WithPlugin + @PluginModule annotations. i have this code in my post function:

 

import com.tempoplugin.team.api.TeamService
import com.tempoplugin.platform.api.user.UserRepository
import com.tempoplugin.accounts.link.api.AccountLinkService
import com.tempoplugin.accounts.link.api.AccountLink
import com.tempoplugin.team.api.Team
import com.tempoplugin.team.service.TeamImpl
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin


@WithPlugin("com.tempoplugin.tempo-teams")

@PluginModule
TeamService teamService

...
...

 

It worked fine with the previous version (5.0.14) but after upgrade to 5.1.6 (jira software 7.5.0) i'm getting:

 

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(NativeConstructorAccessorImpl.java:62)
       ... 1 filtered
       at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
       at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
       at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
       at com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser.transformDeclaration(PluginModuleCompilationCustomiser.groovy:89)
       at com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser$transformDeclaration.callCurrent(Unknown Source)
       at com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser.transform(PluginModuleCompilationCustomiser.groovy:47)
       at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:142)
       at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
       at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
       at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
       at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
       at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
       at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
       at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:53)
       at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
       at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1086)
       at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
       at org.codehaus.groovy.ast.GroovyClassVisitor$visitClass.call(Unknown Source)
       at com.onresolve.scriptrunner.runner.ScriptRunnerImpl$1.call(ScriptRunnerImpl.groovy:570)
       at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1055)
       at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
       at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
       at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
       at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
       at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
       at groovy.util.GroovyScriptEngine$ScriptClassLoader.doParseClass(GroovyScriptEngine.java:256)
       at groovy.util.GroovyScriptEngine$ScriptClassLoader.parseClass(GroovyScriptEngine.java:243)
       at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
       at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:212)
       at groovy.util.GroovyScriptEngine.loadScriptByName(GroovyScriptEngine.java:566)
       at groovy.util.GroovyScriptEngine$loadScriptByName$1.call(Unknown Source)
       at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.loadScriptByName(ScriptRunnerImpl.groovy:648)
       at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runScript(ScriptRunnerImpl.groovy:460)
       at com.onresolve.scriptrunner.runner.ScriptRunner$runScript$7.callCurrent(Unknown Source)
       at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runFileAsScript(ScriptRunnerImpl.groovy:197)
       at com.onresolve.scriptrunner.runner.ScriptRunner$runFileAsScript$8.call(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
       at com.onresolve.scriptrunner.canned.jira.utils.CustomScriptDelegate.doScript(CustomScriptDelegate.groovy:73)
       at com.onresolve.scriptrunner.canned.jira.utils.CustomScriptDelegate$doScript.call(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
       at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CustomScriptFunction.doScript(CustomScriptFunction.groovy:46)
       at com.onresolve.scriptrunner.canned.CannedScript$doScript.call(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
       at com.onresolve.scriptrunner.canned.CannedScript$doScript.call(Unknown Source)
       at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.validateAndRunCannedInternal(ScriptRunnerImpl.groovy:434)
       ... 2 filtered
       at java.lang.reflect.Method.invoke(Method.java:498)
       at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
       at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
       at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runCanned(ScriptRunnerImpl.groovy:379)
       at com.onresolve.scriptrunner.runner.ScriptRunner$runCanned$10.call(Unknown Source)
       at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction.run(ScriptWorkflowFunction.groovy:163)
       at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction$run$2.callCurrent(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
       at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction.execute(ScriptWorkflowFunction.groovy:92)
       at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1014)
       at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1407)
       at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:557)
       at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowActionInsideTxn(OSWorkflowManager.java:830)
       at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowAction(OSWorkflowManager.java:787)
       at com.atlassian.jira.bc.issue.DefaultIssueService.transition(DefaultIssueService.java:492)
       at com.atlassian.jira.web.action.workflow.SimpleWorkflowAction.doExecute(SimpleWorkflowAction.java:28)
       ... 1 filtered
       at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:63)
       ... 7 filtered
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
       ... 19 filtered
       at com.softwareplant.ppm.structureint.jiraserver.event.PluginIssueLinkListener.doFilter(PluginIssueLinkListener.java:55)
       ... 3 filtered
       at com.idalko.jira.plugins.igrid.WebResourceIncludeFilter.doFilter(WebResourceIncludeFilter.java:166)
       ... 36 filtered
       at com.atlassian.greenhopper.jira.filters.ClassicBoardRouter.doFilter(ClassicBoardRouter.java:62)
       ... 12 filtered
       at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
       ... 58 filtered
       at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
       ... 1 filtered
       at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
       ... 36 filtered
       at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
       ... 5 filtered
       at com.idalko.jira.plugins.igrid.servicedesk.ServletRequestContextFilter.doFilter(ServletRequestContextFilter.java:23)
       ... 8 filtered
       at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
       ... 4 filtered
       at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
       ... 26 filtered
       at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
       ... 23 filtered
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
       at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
       at java.lang.Thread.run(Thread.java:745)
1 error

 

Is anyone able to provide any hint, how to make it work again. If i try to downgrade ScriptRunner, this script works again, but there are other errors cause by downgrade, so i need to make it work on this actual version. 

 

Thank You

 

Petr

1 answer

Hi Magnusep,

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:

TeamService teamService = ScriptRunnerImpl.getPluginComponent(TeamService)

And you'll need this import:

import com.onresolve.scriptrunner.runner.ScriptRunnerImpl

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Asked in Jira Service Desk

Calling all Insight users, we need your help!

Hello Insight users,  As part of our (Mindville's) acquisition by Atlassian, our training team is looking to build some new Insight training materials. It would really helpful if you can ...

162 views 1 1
View question

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