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

Packer Plugin Nullpointer Exception and SecurityException: Rejected: net.sf.json.JSONObject

      I'm not sure if this is related to JEP-200, but after Upgrade I receive these Exceptions when using the Packer Plugin:

       

      Feb 23, 2018 12:39:25 PM hudson.model.Run execute
      INFO: packer-centos7 #361 main build action completed: SUCCESS
      Feb 23, 2018 12:39:25 PM biz.neustar.jenkins.plugins.packer.PackerPublisher getRemotePackerExec
      SEVERE: java.lang.NullPointerException
          at biz.neustar.jenkins.plugins.packer.PackerPublisher.getRemotePackerExec(PackerPublisher.java:217)
          at biz.neustar.jenkins.plugins.packer.PackerPublisher.perform(PackerPublisher.java:301)
          at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
          at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
          at hudson.model.Build$BuildExecution.post2(Build.java:186)
          at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
          at hudson.model.Run.execute(Run.java:1752)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:97)
          at hudson.model.Executor.run(Executor.java:429)
      
      Feb 23, 2018 12:39:25 PM biz.neustar.jenkins.plugins.packer.PackerPublisher perform
      SEVERE: java.lang.NullPointerException
          at biz.neustar.jenkins.plugins.packer.PackerPublisher.getName(PackerPublisher.java:84)
          at biz.neustar.jenkins.plugins.packer.PackerPublisher.getRemotePackerExec(PackerPublisher.java:223)
          at biz.neustar.jenkins.plugins.packer.PackerPublisher.perform(PackerPublisher.java:301)
          at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
          at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
          at hudson.model.Build$BuildExecution.post2(Build.java:186)
          at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
          at hudson.model.Run.execute(Run.java:1752)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:97)
          at hudson.model.Executor.run(Executor.java:429)

      Actually this message doesn't apear anymore:

       

      Feb 23, 2018 12:16:47 PM biz.neustar.jenkins.plugins.packer.PackerPublisher getRemotePackerExec
      SEVERE: java.io.IOException: Remote call on server failed
              at hudson.remoting.Channel.call(Channel.java:958)
              at biz.neustar.jenkins.plugins.packer.PackerInstallation.getExecutable(PackerInstallation.java:138)
              at biz.neustar.jenkins.plugins.packer.PackerPublisher.getRemotePackerExec(PackerPublisher.java:220)
              at biz.neustar.jenkins.plugins.packer.PackerPublisher.perform(PackerPublisher.java:301)
              at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
              at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
              at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
              at hudson.model.Build$BuildExecution.post2(Build.java:186)
              at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
              at hudson.model.Run.execute(Run.java:1752)
              at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
              at hudson.model.ResourceController.execute(ResourceController.java:97)
              at hudson.model.Executor.run(Executor.java:429)
      Caused by: java.lang.Error: Failed to deserialize the Callable object.
              at hudson.remoting.UserRequest.perform(UserRequest.java:194)
              at hudson.remoting.UserRequest.perform(UserRequest.java:53)
              at hudson.remoting.Request$2.run(Request.java:364)
              at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
              Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to server
                      at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1737)
                      at hudson.remoting.UserResponse.retrieve(UserRequest.java:313)
                      at hudson.remoting.Channel.call(Channel.java:952)
                      at biz.neustar.jenkins.plugins.packer.PackerInstallation.getExecutable(PackerInstallation.java:138)
                      at biz.neustar.jenkins.plugins.packer.PackerPublisher.getRemotePackerExec(PackerPublisher.java:220)
                      at biz.neustar.jenkins.plugins.packer.PackerPublisher.perform(PackerPublisher.java:301)
                      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
                      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
                      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
                      at hudson.model.Build$BuildExecution.post2(Build.java:186)
                      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
                      at hudson.model.Run.execute(Run.java:1752)
                      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
                      at hudson.model.ResourceController.execute(ResourceController.java:97)
                      at hudson.model.Executor.run(Executor.java:429)
      Caused by: java.lang.SecurityException: Rejected: net.sf.json.JSONObject; see https://jenkins.io/redirect/class-filter/
              at hudson.remoting.ClassFilter.check(ClassFilter.java:64)
              at hudson.remoting.MultiClassLoaderSerializer$Input.resolveClass(MultiClassLoaderSerializer.java:124)
              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620)
              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
              at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2018)

      May we fixed this with

       

      -Dhudson.model.ParametersAction.keepUndefinedParameters=true -Dhudson.remoting.ClassFilter=net.sf.json.JSONObject -Dhudson.remoting.Classfilter=jenkins.security.ClassFilterImpl

          [JENKINS-49715] Packer Plugin Nullpointer Exception and SecurityException: Rejected: net.sf.json.JSONObject

          Oleg Nenashev added a comment -

          I confirm the JEP-200 side of the issue, at least

          Oleg Nenashev added a comment - I confirm the JEP-200 side of the issue, at least

          Oleg Nenashev added a comment -

          The plugin has some test automation which could reproduce the issue. The problem is that it's baseline is 1.554.1, which makes the PCT Compatibility facelift a bit tough.

          Changes to be done:

          • Stop serializing JSON objects over the channel
          • Plugin facelift & PCT

          Oleg Nenashev added a comment - The plugin has some test automation which could reproduce the issue. The problem is that it's baseline is 1.554.1, which makes the PCT Compatibility facelift a bit tough. Changes to be done: Stop serializing JSON objects over the channel Plugin facelift & PCT

          Oleg Nenashev added a comment -

          becke22 Note that JSONObjects are Blacklisted in Remoting. Usage of such workarounds is generally a bad idea

          Oleg Nenashev added a comment - becke22 Note that JSONObjects are Blacklisted in Remoting. Usage of such workarounds is generally a bad idea

          Jesse Glick added a comment -

          The plugin has some test automation which could reproduce the issue.

          Not really. What it has are mocks. Making the existing tests useless for verifying integration issues.

          Jesse Glick added a comment - The plugin has some test automation which could reproduce the issue. Not really. What it has are mocks. Making the existing tests useless for verifying integration issues.

          Code changed in jenkins
          User: jdamick
          Path:
          Jenkinsfile
          pom.xml
          src/main/java/biz/neustar/jenkins/plugins/packer/PackerInstallation.java
          src/main/resources/biz/neustar/jenkins/plugins/packer/PackerFileEntry/config.jelly
          src/main/resources/biz/neustar/jenkins/plugins/packer/PackerInstallation/config.jelly
          src/main/resources/biz/neustar/jenkins/plugins/packer/PackerPublisher/config.jelly
          src/main/resources/index.jelly
          src/test/java/biz/neustar/jenkins/plugins/packer/PackerInstallationTest.java
          src/test/java/biz/neustar/jenkins/plugins/packer/PackerJenkinsPluginTest.java
          http://jenkins-ci.org/commit/packer-plugin/f318a252cdf15b9d0e09e25e925853e1e6a1d538
          Log:
          Merge pull request #22 from jglick/updates-JENKINS-49715

          JENKINS-49715 Facelift & JEP-200 fix

          Compare: https://github.com/jenkinsci/packer-plugin/compare/f8e4347d6530...f318a252cdf1

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: jdamick Path: Jenkinsfile pom.xml src/main/java/biz/neustar/jenkins/plugins/packer/PackerInstallation.java src/main/resources/biz/neustar/jenkins/plugins/packer/PackerFileEntry/config.jelly src/main/resources/biz/neustar/jenkins/plugins/packer/PackerInstallation/config.jelly src/main/resources/biz/neustar/jenkins/plugins/packer/PackerPublisher/config.jelly src/main/resources/index.jelly src/test/java/biz/neustar/jenkins/plugins/packer/PackerInstallationTest.java src/test/java/biz/neustar/jenkins/plugins/packer/PackerJenkinsPluginTest.java http://jenkins-ci.org/commit/packer-plugin/f318a252cdf15b9d0e09e25e925853e1e6a1d538 Log: Merge pull request #22 from jglick/updates- JENKINS-49715 JENKINS-49715 Facelift & JEP-200 fix Compare: https://github.com/jenkinsci/packer-plugin/compare/f8e4347d6530...f318a252cdf1

          Oleg Nenashev added a comment -

          We are still waiting for the release by jdamick. Jenkins 2.107.1 will be released today, and there is a risk that the plugin will be broken after the release

          Oleg Nenashev added a comment - We are still waiting for the release by jdamick . Jenkins 2.107.1 will be released today, and there is a risk that the plugin will be broken after the release

          Jesse Glick added a comment -

          Released in 1.5.

          Jesse Glick added a comment - Released in 1.5.

          Oleg Nenashev added a comment -

          horacer This stacktrace means that your PackerInstallation definition cannot be retrieved for the installation name: https://github.com/jenkinsci/packer-plugin/blob/f8e4347d653001efc85c77e7eec49500710c39e8/src/main/java/biz/neustar/jenkins/plugins/packer/PackerPublisher.java#L217 and https://github.com/jenkinsci/packer-plugin/blob/f8e4347d653001efc85c77e7eec49500710c39e8/src/main/java/biz/neustar/jenkins/plugins/packer/PackerPublisher.java#L197-L205

          The code definitely has a bug in tool handling (no null check). Most likely you have removed the failing Tool loading in "Manage Old Data" so that there is no tool with name defined in the job. Could you please check it?

          Oleg Nenashev added a comment - horacer This stacktrace means that your PackerInstallation definition cannot be retrieved for the installation name: https://github.com/jenkinsci/packer-plugin/blob/f8e4347d653001efc85c77e7eec49500710c39e8/src/main/java/biz/neustar/jenkins/plugins/packer/PackerPublisher.java#L217 and https://github.com/jenkinsci/packer-plugin/blob/f8e4347d653001efc85c77e7eec49500710c39e8/src/main/java/biz/neustar/jenkins/plugins/packer/PackerPublisher.java#L197-L205 The code definitely has a bug in tool handling (no null check). Most likely you have removed the failing Tool loading in "Manage Old Data" so that there is no tool with name defined in the job. Could you please check it?

          Thanks oleg_nenashev It was my fault... I was using a custom packer binary and was just able to solve it by letting Jenkins install the packer binary

          Hendrik Horeis added a comment - Thanks  oleg_nenashev It was my fault... I was using a custom packer binary and was just able to solve it by letting Jenkins install the packer binary

          Hendrik Horeis added a comment - - edited

          oleg_nenashev And you are absolutely right about the failing tool loading part.

          Hendrik Horeis added a comment - - edited oleg_nenashev And you are absolutely right about the failing tool loading part.

            jglick Jesse Glick
            becke22 Björn Becker
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: