\uD83E\uDD14 Problem
The below article explains how to modify the script to resolve the error:
java.lang.RuntimeException: Unable to load FastStringService
\uD83C\uDF31 Solution
This error is typically seen when using the Scripting for Confluence app with Groovy scripts that utilize JsonSlurper and JsonOutput. This error can occur due to conflicts with dependencies, preventing the script from executing.
To resolve this error, modify the Groovy script to use JsonSlurperClassic instead of JsonSlurper and JsonOutput. JsonSlurperClassic is a lightweight alternative to the standard JsonSlurper, and it does not require the FastStringService dependency that causes the error.
Here's an example of how to modify the Groovy script:
import groovy.json.JsonSlurperClassic def json = ''' { "name": "John Smith", "age": 30 } ''' def slurper = new JsonSlurperClassic() def parsedJson = slurper.parseText(json) log.info(parsedJson.name)
We import the JsonSlurperClassic class instead of the JsonSlurper and JsonOutput classes in the revised script. Then we instantiate a new JsonSlurperClassic object and use it to parse the JSON string.
Using JsonSlurperClassic instead of JsonSlurper and JsonOutput, we avoid the dependency conflict that causes the error. This should allow the script to execute without issue.
Testing this in a test instance before moving it to production is recommended.