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

Signature in hudson.tasks.Maven.MavenInstaller.json causes NullPointerException

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • Jenkins 1.423 and 1.414
      Ubuntu 64bit
      JDK 1.6.0_16

      We have three Jenkins instances. Two are on 1.423 and one is on 1.414. Starting sometime on September 8th 2012, our builds on Jenkins all started to fail with the following error:

      FATAL: Error while setting property=signature type class java.lang.Object
      net.sf.json.JSONException: Error while setting property=signature type class java.lang.Object
      	at net.sf.json.JSONObject.toBean(JSONObject.java:577)
      	at net.sf.json.JSONObject.toBean(JSONObject.java:383)
      	at net.sf.json.JSONObject.toBean(JSONObject.java:250)
      	at hudson.tools.DownloadFromUrlInstaller$DescriptorImpl.getInstallables(DownloadFromUrlInstaller.java:151)
      	at hudson.tools.DownloadFromUrlInstaller.getInstallable(DownloadFromUrlInstaller.java:54)
      	at hudson.tools.DownloadFromUrlInstaller.performInstallation(DownloadFromUrlInstaller.java:63)
      	at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:61)
      	at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:107)
      	at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:150)
      	at hudson.tasks.Maven$MavenInstallation.forNode(Maven.java:510)
      	at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:174)
      	at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:582)
      	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:448)
      	at hudson.model.Run.run(Run.java:1376)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:478)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:175)
      Caused by: java.lang.NullPointerException
      	at net.sf.json.JSONObject$MethodProperty.isWritable(JSONObject.java:311)
      	at net.sf.json.JSONObject.toBean(JSONObject.java:429)
      	... 16 more
      

      We were able to narrow it down to hudson.tasks.Maven.MavenInstaller.json that caused the problem by deleting that file from our server and kicking off a job run. The first run without the JSON file will run fine, but subsequent runs fails because the file gets redownloaded from http://updates.jenkins-ci.org/updates/hudson.tasks.Maven.MavenInstaller.json.

      Our current workaround for the problem is that we created an empty (valid) hudson.tasks.Maven.MavenInstaller.json file and turned off the write permission on that file so it won't get updated by Jenkins. We're not sure if there will be any problems if Jenkins tries to update that file again though.

      After doing some research, we believe the following commit caused Jenkins to start breaking:
      https://github.com/jenkinsci/jenkins/commit/62f66f899c95ccdfdc7a5d3346240988b42a9aad

      Looks like the change causes the MavenInstaller JSON file to add a new "signature" block, which our Jenkins version cannot handle.

          [JENKINS-15105] Signature in hudson.tasks.Maven.MavenInstaller.json causes NullPointerException

          sunil kumar added a comment -

          if some one the found solution to this problem. please let me know.

          sunil kumar added a comment - if some one the found solution to this problem. please let me know.

          Investigating. This would significantly limit our ability to evolve JSON data structure. Argh.

          Kohsuke Kawaguchi added a comment - Investigating. This would significantly limit our ability to evolve JSON data structure. Argh.

          this change in json-lib was supposed to make this kind of databinding relaxing. This change made it into json-lib-2.1-rev7, and this appeared in core in this commit, which got released as 1.424.

          Kohsuke Kawaguchi added a comment - this change in json-lib was supposed to make this kind of databinding relaxing. This change made it into json-lib-2.1-rev7, and this appeared in core in this commit , which got released as 1.424.

          So one work around is to upgrade to 1.424 or later.

          But given that 5 people found this problem within just a few days (plus it breaks all the builds!), I think I need to revert the data structure back and figure out another way to do this.

          Kohsuke Kawaguchi added a comment - So one work around is to upgrade to 1.424 or later. But given that 5 people found this problem within just a few days (plus it breaks all the builds!), I think I need to revert the data structure back and figure out another way to do this.

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          core/src/test/java/jenkins/ResilientJsonObjectTest.java
          http://jenkins-ci.org/commit/jenkins/1b3eb0b9e7a3ee35d6c40d5e4460f4bb1f17e0e9
          Log:
          added a test to check for regressions in JENKINS-15105.

          Compare: https://github.com/jenkinsci/jenkins/compare/24556ac8523b...1b3eb0b9e7a3

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: core/src/test/java/jenkins/ResilientJsonObjectTest.java http://jenkins-ci.org/commit/jenkins/1b3eb0b9e7a3ee35d6c40d5e4460f4bb1f17e0e9 Log: added a test to check for regressions in JENKINS-15105 . Compare: https://github.com/jenkinsci/jenkins/compare/24556ac8523b...1b3eb0b9e7a3

          The metadata has been updated not to include the signature in the JSON files.

          (The signature was moved to the .json.html files)

          Kohsuke Kawaguchi added a comment - The metadata has been updated not to include the signature in the JSON files. (The signature was moved to the .json.html files)

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          core/src/main/java/hudson/model/DownloadService.java
          war/src/main/webapp/scripts/hudson-behavior.js
          http://jenkins-ci.org/commit/jenkins/f3701da9e215abeaadef39c1f47021cb6e4d479b
          Log:
          JENKINS-15105

          Prefer the postMessage version to retrieve the metadata so that we can leave the existing JSON format as-is for backward compatibility with pre-1.424 Jenkins.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: core/src/main/java/hudson/model/DownloadService.java war/src/main/webapp/scripts/hudson-behavior.js http://jenkins-ci.org/commit/jenkins/f3701da9e215abeaadef39c1f47021cb6e4d479b Log: JENKINS-15105 Prefer the postMessage version to retrieve the metadata so that we can leave the existing JSON format as-is for backward compatibility with pre-1.424 Jenkins.

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          core/src/main/java/hudson/model/DownloadService.java
          war/src/main/webapp/scripts/hudson-behavior.js
          http://jenkins-ci.org/commit/jenkins/ad61369d7b4c774db4fe3606cc71dfad797bf49f
          Log:
          JENKINS-15105

          Prefer the postMessage version to retrieve the metadata so that we can leave the existing JSON format as-is for backward compatibility with pre-1.424 Jenkins.
          (cherry picked from commit f3701da9e215abeaadef39c1f47021cb6e4d479b)

          Conflicts:

          war/src/main/webapp/scripts/hudson-behavior.js

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: core/src/main/java/hudson/model/DownloadService.java war/src/main/webapp/scripts/hudson-behavior.js http://jenkins-ci.org/commit/jenkins/ad61369d7b4c774db4fe3606cc71dfad797bf49f Log: JENKINS-15105 Prefer the postMessage version to retrieve the metadata so that we can leave the existing JSON format as-is for backward compatibility with pre-1.424 Jenkins. (cherry picked from commit f3701da9e215abeaadef39c1f47021cb6e4d479b) Conflicts: war/src/main/webapp/scripts/hudson-behavior.js

          dogfood added a comment -

          Integrated in jenkins_main_trunk #1927
          JENKINS-15105 (Revision f3701da9e215abeaadef39c1f47021cb6e4d479b)

          Result = SUCCESS
          kohsuke : f3701da9e215abeaadef39c1f47021cb6e4d479b
          Files :

          • war/src/main/webapp/scripts/hudson-behavior.js
          • core/src/main/java/hudson/model/DownloadService.java

          dogfood added a comment - Integrated in jenkins_main_trunk #1927 JENKINS-15105 (Revision f3701da9e215abeaadef39c1f47021cb6e4d479b) Result = SUCCESS kohsuke : f3701da9e215abeaadef39c1f47021cb6e4d479b Files : war/src/main/webapp/scripts/hudson-behavior.js core/src/main/java/hudson/model/DownloadService.java

            kohsuke Kohsuke Kawaguchi
            jlin jlin
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: