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

Exception on saving job with scriptler+active choices without Administrative permission

      After upgrading to the versions stated in Environment section the users without Admin permission cannot modify/save any job with Active Choices + Scriptler parameters.

      Several exceptions appear and the job fails to be saved.

      The full exception is in the attachment.

      2022-11-11 11:00:26.630+0000 [id=3362342]        WARNING        o.e.j.s.h.ContextHandler$Context#log: Error while serving http://jenkins.example.local/job/tmp/configSubmit
      org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.jenkinsci.plugins.scriptler.builder.ScriptlerBuilder
      at org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:288)
      at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:837)
      at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:741)
      Caused: java.lang.IllegalArgumentException: Failed to instantiate class org.jenkinsci.plugins.scriptler.builder.ScriptlerBuilder from {"backupJobName":"","builderId":"1668163507392_2","scriptlerScriptId":"sb_component_selector.groovy","propagateParams":false}
      at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:744)
      at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:524)
      at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:850)
      Caused: java.lang.IllegalArgumentException: Failed to convert the scriptlerBuilder parameter of the constructor public org.biouno.unochoice.model.ScriptlerScript(org.jenkinsci.plugins.scriptler.builder.ScriptlerBuilder,java.lang.Boolean)
      at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:852)
      at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:741)
      Caused: java.lang.IllegalArgumentException: Failed to instantiate class org.biouno.unochoice.model.ScriptlerScript from {"value":"1","scriptlerBuilder":{"backupJobName":"","builderId":"1668163507392_2","scriptlerScriptId":"sb_component_selector.groovy","propagateParams":false},"isSandboxed":false,"stapler-class<span class="code-quote">":"org.biouno.unochoice.model.ScriptlerScript","$class<span class="code-quote">":"org.biouno.unochoice.model.ScriptlerScript"}
      at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:744)
      at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:524)
      at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:519)
      at hudson.model.Descriptor.bindJSON(Descriptor.java:621)
      at hudson.model.Descriptor.newInstance(Descriptor.java:591)
      Caused: java.lang.LinkageError: Failed to instantiate class org.biouno.unochoice.model.ScriptlerScript from {"value":"1","scriptlerBuilder":{"backupJobName":"","builderId":"1668163507392_2","scriptlerScriptId":"sb_component_selector.groovy","propagateParams":false},"isSandboxed":false,"stapler-class<span class="code-quote">":"org.biouno.unochoice.model.ScriptlerScript","$class<span class="code-quote">":"org.biouno.unochoice.model.ScriptlerScript"}
       

          [JENKINS-70066] Exception on saving job with scriptler+active choices without Administrative permission

          Hi, any updates?

          ScriptlerVersion363.vd97ef616cb_f9

          Active Choices Plug-inVersion2.8.3

          Jenkins 2.463 throw the same exception for non administer user

          Caught unhandled exception with ID e41f58e9-ea18-44e1-b075-685fe9908947
          java.lang.NullPointerException: Cannot invoke "java.util.Collection.toArray()" because "<parameter1>" is null
          	at java.base/java.util.ArrayList.<init>(Unknown Source)
          	at PluginClassLoader for scriptler//org.jenkinsci.plugins.scriptler.builder.ScriptlerBuilder.<init>(ScriptlerBuilder.java:89)
          	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(Unknown Source)
          	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
          	at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
          	at org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:657)
          	at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:970)
          	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:841)
          	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:604)
          	at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:963)
          	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:841)
          	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:604)
          	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:599)
          	at hudson.model.Descriptor.bindJSON(Descriptor.java:624)
          	at hudson.model.Descriptor.newInstance(Descriptor.java:594)
          Caused: java.lang.LinkageError: Failed to instantiate class org.biouno.unochoice.model.ScriptlerScript from {"value":"1","scriptlerBuilder":{"backupJobName":"","builderId":"","scriptlerScriptId":"mi_service_branch.groovy","propagateParams":false},"isSandboxed":false,"stapler-class<span class="code-quote">":"org.biouno.unochoice.model.ScriptlerScript","$class<span class="code-quote">":"org.biouno.unochoice.model.ScriptlerScript"} 

          Andrew Kazachenko added a comment - Hi, any updates? ScriptlerVersion363.vd97ef616cb_f9 Active Choices Plug-inVersion2.8.3 Jenkins 2.463 throw the same exception for non administer user Caught unhandled exception with ID e41f58e9-ea18-44e1-b075-685fe9908947 java.lang.NullPointerException: Cannot invoke "java.util.Collection.toArray()" because "<parameter1>" is null at java.base/java.util.ArrayList.<init>(Unknown Source) at PluginClassLoader for scriptler //org.jenkinsci.plugins.scriptler.builder.ScriptlerBuilder.<init>(ScriptlerBuilder.java:89) at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source) at org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:657) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:970) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:841) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:604) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:963) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:841) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:604) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:599) at hudson.model.Descriptor.bindJSON(Descriptor.java:624) at hudson.model.Descriptor.newInstance(Descriptor.java:594) Caused: java.lang.LinkageError: Failed to instantiate class org.biouno.unochoice.model.ScriptlerScript from { "value" : "1" , "scriptlerBuilder" :{ "backupJobName" : ""," builderId ":" "," scriptlerScriptId ":" mi_service_branch.groovy "," propagateParams ": false }," isSandboxed ": false ," stapler- class span class="code-quote">":" org.biouno.unochoice.model.ScriptlerScript "," $ class span class="code-quote">":" org.biouno.unochoice.model.ScriptlerScript"}

          Sorry, I haven't had time to reproduce it yet. For when  I try to reproduce this, does it sound like a valid scenario to test, andrewkozak, theus  ?

          • Jenkins = 2.361
          • Active Choices < 2.6.4
          • Create any example job with Active Choices + a simple Scriptler parameter
          • Upgrade to Active Choices 2.6.+

          That should trigger the error above. Correct?

          Thanks

          Bruno P. Kinoshita added a comment - Sorry, I haven't had time to reproduce it yet. For when  I try to reproduce this, does it sound like a valid scenario to test, andrewkozak , theus   ? Jenkins = 2.361 Active Choices < 2.6.4 Create any example job with Active Choices + a simple Scriptler parameter Upgrade to Active Choices 2.6.+ That should trigger the error above. Correct? Thanks

          Hi andrewkozak 

          Are you having the same issue reported here? i.e. you had a version of Jenkins with Active Choices (if so which one?), then upgraded to 2.8.3 and got this error, like OP? If so, anything special in your config.xml, or could you provide it, please? Thanks

          Bruno P. Kinoshita added a comment - Hi andrewkozak   Are you having the same issue reported here? i.e. you had a version of Jenkins with Active Choices (if so which one?), then upgraded to 2.8.3 and got this error, like OP? If so, anything special in your config.xml, or could you provide it, please? Thanks

          I see 3 potential issues in this Jira ticket, all relating to the Scriptler plugin:

          1. The ticket's description, which I don't think was ever actually the issue, but many permissions were cleaned up in release 384.v5d0d63f4a_51e
          2. theus's original exception, which should have been fixed in release 334.v29792d5a_c058.
          3. andrewkozak's exception, which was just fixed in release 392.va_dce718b_3e40 (backported as releases 384.387.vb_5cb_a_f774857 and 376.378.v843c72a_5d055).

          I think everything should be taken care of now.

          Michael Tughan added a comment - I see 3 potential issues in this Jira ticket, all relating to the Scriptler plugin: The ticket's description, which I don't think was ever actually the issue, but many permissions were cleaned up in release 384.v5d0d63f4a_51e theus 's original exception, which should have been fixed in release 334.v29792d5a_c058 . andrewkozak 's exception, which was just fixed in release 392.va_dce718b_3e40 (backported as releases 384.387.vb_5cb_a_f774857 and 376.378.v843c72a_5d055 ). I think everything should be taken care of now.

          Thank you Michael!

          Bruno P. Kinoshita added a comment - Thank you Michael!

          Vitaly Agapov added a comment -

          The current state:
          Jenkins  2.479.3
          Active Choices Plug-in 2.8.6
          Scriptler 384.387.vb_5cb_a_f774857

          There are no more exceptions. And users without Admin permission now can modify/save any job with Active Choices + Scriptler parameters.
          BUT when they do that, the Scriptler scripts are just being changed to (Default) ones. So any modification of the job by any non-admin user just breaks the job until any admin user comes and restores the Scriptler script in the Active Choices parameter.

           

          Vitaly Agapov added a comment - The current state: Jenkins  2.479.3 Active Choices Plug-in 2.8.6 Scriptler 384.387.vb_5cb_a_f774857 There are no more exceptions. And users without Admin permission now can modify/save any job with Active Choices + Scriptler parameters. BUT when they do that, the Scriptler scripts are just being changed to (Default) ones. So any modification of the job by any non-admin user just breaks the job until any admin user comes and restores the Scriptler script in the Active Choices parameter.  

          theus, I'm able to reproduce what you're describing and I can see why it's happening. Let me think on this a bit as to how we can deal with it and I'll see what we can do.

          Michael Tughan added a comment - theus , I'm able to reproduce what you're describing and I can see why it's happening. Let me think on this a bit as to how we can deal with it and I'll see what we can do.

            kinow Bruno P. Kinoshita
            theus Vitaly Agapov
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: