Uploaded image for project: 'SR Platform'
  1. SR Platform
  2. SRPLAT-560

Occasional NoClassDefFound with @WithPlugin compilation customiser

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Done
    • Affects Version/s: 5.4.45, 5.4.47, 5.4.48
    • Fix Version/s: 5.6.1
    • Component/s: None
    • Labels:
      None
    • Sprint:
      Sprint 55, Sprint 56
    • Critical Points:
      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

            Activity

              People

              Assignee:
              merdmann Marcin Erdmann
              Reporter:
              ahasan Ashraful Hasan [X] (Inactive)
              Votes:
              12 Vote for this issue
              Watchers:
              27 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: