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

Docker: Build step failed with exception net.sf.json.JSONException: null object

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Blocker Blocker
    • docker-commons-plugin
    • jenkins-lts v2.361.1
      docker-common v1.21
      CloudBees Docker Build and Publish plugin v1.4.0

      ERROR: Build step failed with exception
      net.sf.json.JSONException: null object
      at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2688)
      at net.sf.json.JSONObject.element(JSONObject.java:1733)
      at net.sf.json.JSONObject.element(JSONObject.java:1716)
      at net.sf.json.JSONObject.put(JSONObject.java:2328)
      at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:154)
      at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:129)
      at hudson.remoting.LocalChannel.call(LocalChannel.java:47)
      at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken.newKeyMaterialFactory(DockerRegistryToken.java:129)
      at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:273)
      at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:258)
      at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:250)
      at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:457)
      at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:431)
      at com.cloudbees.dockerpublish.DockerBuilder$Perform.buildAndTag(DockerBuilder.java:373)
      at com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:311)
      at com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:291)
      at com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:262)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:816)
      at hudson.model.Build$BuildExecution.build(Build.java:199)
      at hudson.model.Build$BuildExecution.doRun(Build.java:164)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
      at hudson.model.Run.execute(Run.java:1899)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
      at hudson.model.ResourceController.execute(ResourceController.java:107)
      at hudson.model.Executor.run(Executor.java:449)
      Build step 'Docker Build and Publish' marked build as failure
      Finished: FAILURE

          [JENKINS-69702] Docker: Build step failed with exception net.sf.json.JSONException: null object

          Mark Waite added a comment -

          Thanks for reporting the stack trace. That may help others if they encounter the same stack trace. Unfortunately, this issue does not include enough information for anyone else to take action on it. I will plan to close this in a week as "cannot reproduce" if more information is not provided.

          See "How to report an issue" for guidance on the types of information needed for others to be able to act on an issue report.

          Mark Waite added a comment - Thanks for reporting the stack trace. That may help others if they encounter the same stack trace. Unfortunately, this issue does not include enough information for anyone else to take action on it. I will plan to close this in a week as "cannot reproduce" if more information is not provided. See "How to report an issue" for guidance on the types of information needed for others to be able to act on an issue report.

          Ankit Giri added a comment -

          Hi markewaite 

          Thanks for replying to m query. Here is some detail that would help to understand the issue.

          I am able to pull the code from this repo and run the build step. It is failing at step 2.

          Repository: https://github.com/ankitgiri45/JenkinsDockerNodeJS

          Build Step

          1. Running a shell script. (Success)
          2. Running Docker Build and Publish. (Failed)

           

          Console output: 

           

          Started by user Ankit Giri
          Running as SYSTEM
          Building in workspace /Users/sandeepgiri/.jenkins/workspace/nodejs app
          The recommended git tool is: NONE
          using credential GitHubLoginSSH
          Wiping out workspace first.
          Cloning the remote Git repository
          Cloning repository git@github.com:ankitgiri45/JenkinsDockerNodeJS.git
           > git init /Users/sandeepgiri/.jenkins/workspace/nodejs app # timeout=10
          Fetching upstream changes from git@github.com:ankitgiri45/JenkinsDockerNodeJS.git
           > git --version # timeout=10
           > git --version # 'git version 2.32.1 (Apple Git-133)'
          using GIT_SSH to set credentials 
          Verifying host key using known hosts file
           > git fetch --tags --force --progress -- git@github.com:ankitgiri45/JenkinsDockerNodeJS.git +refs/heads/*:refs/remotes/origin/* # timeout=10
           > git config remote.origin.url git@github.com:ankitgiri45/JenkinsDockerNodeJS.git # timeout=10
           > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
          Avoid second fetch
           > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
          Checking out Revision 986f46321c73c25f48b3e74f27463b5ee692c379 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f 986f46321c73c25f48b3e74f27463b5ee692c379 # timeout=10
          Commit message: "Added start scriptin package.json"
           > git rev-list --no-walk 986f46321c73c25f48b3e74f27463b5ee692c379 # timeout=10
          [nodejs app] $ /bin/sh -xe /var/folders/wk/tllr12hs06l4kkbn9qszgfdr0000gn/T/jenkins2743315682087281443.sh
          + npm install
          
          added 57 packages, and audited 58 packages in 4s
          
          7 packages are looking for funding
            run `npm fund` for details
          
          found 0 vulnerabilities
          ERROR: Build step failed with exception
          net.sf.json.JSONException: null object
          	at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2688)
          	at net.sf.json.JSONObject.element(JSONObject.java:1733)
          	at net.sf.json.JSONObject.element(JSONObject.java:1716)
          	at net.sf.json.JSONObject.put(JSONObject.java:2328)
          	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:154)
          	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:129)
          	at hudson.remoting.LocalChannel.call(LocalChannel.java:47)
          	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken.newKeyMaterialFactory(DockerRegistryToken.java:129)
          	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:273)
          	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:258)
          	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:250)
          	at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:457)
          	at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:431)
          	at com.cloudbees.dockerpublish.DockerBuilder$Perform.buildAndTag(DockerBuilder.java:373)
          	at com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:311)
          	at com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:291)
          	at com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:262)
          	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:816)
          	at hudson.model.Build$BuildExecution.build(Build.java:199)
          	at hudson.model.Build$BuildExecution.doRun(Build.java:164)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
          	at hudson.model.Run.execute(Run.java:1899)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
          	at hudson.model.ResourceController.execute(ResourceController.java:107)
          	at hudson.model.Executor.run(Executor.java:449)
          Build step 'Docker Build and Publish' marked build as failure
          Finished: FAILURE 

           

           

           

          Ankit Giri added a comment - Hi markewaite   Thanks for replying to m query. Here is some detail that would help to understand the issue. I am able to pull the code from this repo and run the build step. It is failing at step 2. Repository: https://github.com/ankitgiri45/JenkinsDockerNodeJS Build Step Running a shell script. (Success) Running Docker Build and Publish. (Failed)   Console output:     Started by user Ankit Giri Running as SYSTEM Building in workspace /Users/sandeepgiri/.jenkins/workspace/nodejs app The recommended git tool is: NONE using credential GitHubLoginSSH Wiping out workspace first. Cloning the remote Git repository Cloning repository git@github.com:ankitgiri45/JenkinsDockerNodeJS.git > git init /Users/sandeepgiri/.jenkins/workspace/nodejs app # timeout=10 Fetching upstream changes from git@github.com:ankitgiri45/JenkinsDockerNodeJS.git > git --version # timeout=10 > git --version # 'git version 2.32.1 (Apple Git-133)' using GIT_SSH to set credentials Verifying host key using known hosts file > git fetch --tags --force --progress -- git@github.com:ankitgiri45/JenkinsDockerNodeJS.git +refs/heads/*:refs/remotes/origin/* # timeout=10 > git config remote.origin.url git@github.com:ankitgiri45/JenkinsDockerNodeJS.git # timeout=10 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 Avoid second fetch > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision 986f46321c73c25f48b3e74f27463b5ee692c379 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 986f46321c73c25f48b3e74f27463b5ee692c379 # timeout=10 Commit message: "Added start scriptin package .json" > git rev-list --no-walk 986f46321c73c25f48b3e74f27463b5ee692c379 # timeout=10 [nodejs app] $ /bin/sh -xe / var /folders/wk/tllr12hs06l4kkbn9qszgfdr0000gn/T/jenkins2743315682087281443.sh + npm install added 57 packages, and audited 58 packages in 4s 7 packages are looking for funding run `npm fund` for details found 0 vulnerabilities ERROR: Build step failed with exception net.sf.json.JSONException: null object at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2688) at net.sf.json.JSONObject.element(JSONObject.java:1733) at net.sf.json.JSONObject.element(JSONObject.java:1716) at net.sf.json.JSONObject.put(JSONObject.java:2328) at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:154) at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:129) at hudson.remoting.LocalChannel.call(LocalChannel.java:47) at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken.newKeyMaterialFactory(DockerRegistryToken.java:129) at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:273) at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:258) at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:250) at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:457) at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:431) at com.cloudbees.dockerpublish.DockerBuilder$Perform.buildAndTag(DockerBuilder.java:373) at com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:311) at com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:291) at com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:262) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:816) at hudson.model.Build$BuildExecution.build(Build.java:199) at hudson.model.Build$BuildExecution.doRun(Build.java:164) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524) at hudson.model.Run.execute(Run.java:1899) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) at hudson.model.ResourceController.execute(ResourceController.java:107) at hudson.model.Executor.run(Executor.java:449) Build step 'Docker Build and Publish' marked build as failure Finished: FAILURE      

          Mark Waite added a comment -

          That's much more context than before, though I suspect that the maintainers of the plugin would much prefer a series of steps that they can use to duplicate the problem. I'm not one of the maintainers of the plugin, just someone that tries to encourage others to provide enough detail in their bug reports that others have a chance of helping.

          Mark Waite added a comment - That's much more context than before, though I suspect that the maintainers of the plugin would much prefer a series of steps that they can use to duplicate the problem. I'm not one of the maintainers of the plugin, just someone that tries to encourage others to provide enough detail in their bug reports that others have a chance of helping.

          Ankit Giri added a comment -

          Thanks, markewaite 

          Hoping to get some help soon.

          Ankit Giri added a comment - Thanks, markewaite   Hoping to get some help soon.

          waising added a comment -

          When I login to the harbor registry,  it can run normally!

          waising added a comment - When I login to the harbor registry,  it can run normally!

          Ankit Giri added a comment -

          Hi waising 

          Thanks for responding Could you please elaborate more on this what steps you did?

          Ankit Giri added a comment - Hi waising   Thanks for responding Could you please elaborate more on this what steps you did?

          waising added a comment - - edited

          Need to log in harbor address

          cat /etc/docker/daemon.json

          { "insecure-registries": ["192.168.100.20:80"] }

          login harbor

          docker login -u admin -p Harbor12345 192.168.100.20:80

          waising added a comment - - edited Need to log in harbor address cat /etc/docker/daemon.json { "insecure-registries": ["192.168.100.20:80"] } login harbor docker login -u admin -p Harbor12345 192.168.100.20:80

          Mark Waite added a comment -

          Closing after many months with no further progress.

          Mark Waite added a comment - Closing after many months with no further progress.

            Unassigned Unassigned
            ankitgiri45 Ankit Giri
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: