\uD83E\uDD14 Problem
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, and it prevents 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)
In the modified script, we import the JsonSlurperClassic class instead of the JsonSlurper and JsonOutput classes. Then we instantiate a new JsonSlurperClassic object and use it to parse the JSON string.
By 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.
It is recommended to test this in a test instance first before moving it to production