Details
-
Bug
-
Status: Done
-
High
-
Resolution: Done
-
5.4.45, 5.4.47, 5.4.48
-
None
-
None
-
Sprint 55, Sprint 56
-
7.8
Description
1. Run the following script from script console. The script executes as expected.
import com.atlassian.servicedesk.api.field.FieldInputValue import com.onresolve.scriptrunner.runner.customisers.WithPlugin @WithPlugin("com.atlassian.servicedesk") def val = FieldInputValue.withValue(10) log.debug "Value : ${val.value()}"
2. Now create a custom REST end point with the following code in a script file (not in inline script)
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate import groovy.json.JsonBuilder import groovy.transform.BaseScript import javax.ws.rs.core.MultivaluedMap import javax.ws.rs.core.Response import com.atlassian.servicedesk.api.field.FieldInputValue import com.onresolve.scriptrunner.runner.customisers.WithPlugin @WithPlugin("com.atlassian.servicedesk") @BaseScript CustomEndpointDelegate delegate doSomething(httpMethod: "GET", groups: ["jira-administrators"]) { MultivaluedMap queryParams, String body -> def val = FieldInputValue.withValue(10) return Response.ok(new JsonBuilder([abc: val.value()]).toString()).build(); }
The output should be 500 with java.lang.NoClassDefFoundError
Potential Workarounds
This bug seems to affect multiple plugins (not just Jira Service Desk), on at least 2 of the ScriptRunner platforms (Jira & Confluence). A quick-fix is to simply disable and re-enable ScriptRunner after any plugins your scripts depend on have installed and enabled.
This may well be a regression of SRPLAT-77.
Jira Only
The built in script to clear the Groovy classloader has resolved this problem for a few customers.
Attachments
Issue Links
- causes
-
SRBITB-437 SimpleUserAccessGrant class not found when cloning a repo with branch permissions
-
- Done
-
- incorporates
-
SRJIRA-2388 @PluginModule does not correctly load classes
-
- Done
-
- relates to
-
SRPLAT-77 race condition when using WithPlugin
-
- Done
-