Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-35140

JsonSlurper does not work after updating to Jenkins 2.x

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • script-security-plugin
    • None
    • Jenkins 2.6, pipeline 2.1, script-security 1.19

      After installing jenkins 2.6 locally to test my pipeline scripts, I am unable to use JsonSlurper due to errors about LazyMap not being serializable.

      java.io.NotSerializableException: groovy.json.internal.LazyMap
      

      That can't be changed so I looked for a workaround and tried passing the LazyMap into the constructor of a new HashMap:

      org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use new java.util.HashMap java.util.Map
      

      So then I found the JsonSlurperClassic class, which should solve the issue by going back to the Groovy 1.x behavior, however then I get:

      org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use new groovy.json.JsonSlurperClassic
      

      None of these errors show up in the script approval queue, so I can't whitelist them myself. Please add new JsonSlurperClassic and/or new HashMap to the default whitelist. This will block my upgrade to 2.x otherwise.

            abayer Andrew Bayer
            jacobfike Jacob Fike
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: