Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-14163

Workflow: Groovy classpath problem

    Details

      Description

      Groovy was upgraded in OPENIDM-13453 and OPENIDM-12245, but it appears that there is a classpath problem with Workflow use-cases.

      Attached the file managedUserApproval.bar

      Reproduction notes:

      # Workflow sync-asynchronous sample
      #     https://backstage.forgerock.com/docs/idm/6.5/samples-guide/#chap-sync-asynchronous
      
      # replace the managedUserApproval.bar BAR file in directory below
      open openidm/samples/sync-asynchronous/workflow/
      
      ./openidm/startup.sh -p openidm/samples/sync-asynchronous jpda
      
      curl \
       --header "X-OpenIDM-Username: openidm-admin" \
       --header "X-OpenIDM-Password: openidm-admin" \
       --header "Content-Type: application/json" \
       --request POST \
       --data '{
       "userName": "async.admin",
       "givenName": "async",
       "sn" : "admin",
       "password" : "Passw0rd",
       "displayName" : "async admin",
       "mail" : "async.admin@example.com",
       "authzRoles": [
          {"_ref": "internal/role/openidm-admin"},
          {"_ref": "internal/role/openidm-authorized"}
       ],
       "_id" : "asyncadmin"
       }' \
       "http://localhost:8080/openidm/managed/user?_action=create" | jq
       
      curl \
       --header "X-OpenIDM-Username: openidm-admin" \
       --header "X-OpenIDM-Password: openidm-admin" \
       --request POST \
       "http://localhost:8080/openidm/recon?_action=recon&mapping=systemCsvfileAccounts_managedUser" | jq
       
       curl \
       --header "X-OpenIDM-Username: openidm-admin" \
       --header "X-OpenIDM-Password: openidm-admin" \
       --request GET \
       "http://localhost:8080/openidm/workflow/taskinstance?_queryId=query-all-ids" | jq
       
      curl \
       --header "X-OpenIDM-Username: async.admin" \
       --header "X-OpenIDM-Password: Passw0rd" \
       --header "Content-Type: application/json" \
       --request POST \
       --data '{"requestApproved": "true"}' \
       "http://localhost:8080/openidm/workflow/taskinstance/34?_action=complete" | jq
      

      Stacktrace:

      Caused by: javax.script.ScriptException: javax.script.ScriptException: java.lang.RuntimeException: Unable to load FastStringService
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158)
      	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
      	at org.forgerock.openidm.workflow.activiti.osgi.ActivitiOsgiScriptingEngines.evaluate(ActivitiOsgiScriptingEngines.java:76)
      	... 198 more
      Caused by: javax.script.ScriptException: java.lang.RuntimeException: Unable to load FastStringService
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320)
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155)
      	... 200 more
      Caused by: java.lang.RuntimeException: Unable to load FastStringService
      	at org.apache.groovy.json.internal.FastStringUtils.getService(FastStringUtils.java:57)
      	at org.apache.groovy.json.internal.FastStringUtils.toCharArray(FastStringUtils.java:67)
      	at org.apache.groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:110)
      	at groovy.json.JsonSlurper.parseText(JsonSlurper.java:202)
      	at groovy.json.JsonSlurper$parseText.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
      	at Script2.run(Script2.groovy:3)
      	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
      	... 201 more
      

      This is specifically needed because Groovy uses SPI, a thread-local classloader, and a static initializer in some places. For example:

      https://github.com/apache/groovy/blob/ac0e1d232f0612518a87ce2aa5e443e0975cb3f4/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/FastStringUtils.java#L36

        Attachments

          Activity

            People

            • Assignee:
              travis.haagen Travis Haagen
              Reporter:
              travis.haagen Travis Haagen
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: