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

Occasional NoClassDefFound with @WithPlugin compilation customiser

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Done
    • High
    • Resolution: Done
    • 5.4.45, 5.4.47, 5.4.48
    • 5.6.1
    • 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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: