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

Parameterized Remote Trigger Plugin fails with 'FATAL: Invalid JSON String' after triggering the remote build

    Details

    • Similar Issues:

      Description

      I've a local jenkins server and provided a remote jenkins server.

      My local build is triggering the remote build, which is running and being built successfully, but the local job fails with the following exception:

      Triggering this remote job: <REMOTE_BUILD_JOB>
      Not checking if the remote job <REMOTE_BUILD_JOB> is building.
      This job is build #[12] on the remote server.
      Triggering remote job now.
      FATAL: Invalid JSON String
      net.sf.json.JSONException: Invalid JSON String
      	at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:143)
      	at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:103)
      	at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:84)
      	at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.sendHTTPCall(RemoteBuildConfiguration.java:698)
      	at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.perform(RemoteBuildConfiguration.java:529)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:784)
      	at hudson.model.Build$BuildExecution.build(Build.java:199)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:160)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:565)
      	at hudson.model.Run.execute(Run.java:1670)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:231)
      

      Any suggestions what could be wrong?

        Attachments

          Activity

          Hide
          bfoley19 Brent Foley added a comment -

          After playing around with the configuration, I found that you only get this error if you don't send any parameters. If you add a parameter it will go through without errors. This is a workaround obviously as the plugin should allow for empty parameters.

          Show
          bfoley19 Brent Foley added a comment - After playing around with the configuration, I found that you only get this error if you don't send any parameters. If you add a parameter it will go through without errors. This is a workaround obviously as the plugin should allow for empty parameters.
          Hide
          mskorna Maik Skorna added a comment -

          Thanks Brent !

          Show
          mskorna Maik Skorna added a comment - Thanks Brent !
          Hide
          canuck1987 Tim Brown added a comment - - edited

          Looks like the URL used when no parameters are provided (normalBuildUrl=build) doesn't return any JSON. When the paramerizedBuildUrl URL is used (buildWithParameters) Jenkins returns a JSON string that is converted into an object.

          I looked into just using 'buildWithParameters' for both, but I get a 500 error when calling non-parameterised jobs with 'buildWithParameters'.

          I see two options:
          You can update sendHTTPCall to return null when no JSON is returned from the remote Server. The main issue with this method is all calls to sendHTTPCall will have to check response for null values.
          Either that or pass the bug to JenkinsCore to ask them to return JSON objects from 'build' link.

          Show
          canuck1987 Tim Brown added a comment - - edited Looks like the URL used when no parameters are provided (normalBuildUrl=build) doesn't return any JSON. When the paramerizedBuildUrl URL is used (buildWithParameters) Jenkins returns a JSON string that is converted into an object. I looked into just using 'buildWithParameters' for both, but I get a 500 error when calling non-parameterised jobs with 'buildWithParameters'. I see two options: You can update sendHTTPCall to return null when no JSON is returned from the remote Server. The main issue with this method is all calls to sendHTTPCall will have to check response for null values. Either that or pass the bug to JenkinsCore to ask them to return JSON objects from 'build' link.
          Hide
          canuck1987 Tim Brown added a comment -

          Have submitted pull request for a patch to this issue.

          Please feel free to use it or ignore it as you wish .

          Show
          canuck1987 Tim Brown added a comment - Have submitted pull request for a patch to this issue. Please feel free to use it or ignore it as you wish .
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: tim.brown5
          Path:
          src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfiguration.java
          http://jenkins-ci.org/commit/parameterized-remote-trigger-plugin/a9dda51bf9db876017402ce91bc4b70e0ee08ec6
          Log:
          Added a fix for issue Jenkins JENKINS-22325. The issue is that when using the 'build' URL to trigger a job without parameters we don't jsut a JSOn response back. This makes sendHTTPCall fail when it tries to create a JSON object out of the response. The fix is to check if the response is empty and if so return null from sendHTTPCall. This means any call to sendHTTPCall will have to be checked for 'null responses.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tim.brown5 Path: src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfiguration.java http://jenkins-ci.org/commit/parameterized-remote-trigger-plugin/a9dda51bf9db876017402ce91bc4b70e0ee08ec6 Log: Added a fix for issue Jenkins JENKINS-22325 . The issue is that when using the 'build' URL to trigger a job without parameters we don't jsut a JSOn response back. This makes sendHTTPCall fail when it tries to create a JSON object out of the response. The fix is to check if the response is empty and if so return null from sendHTTPCall. This means any call to sendHTTPCall will have to be checked for 'null responses.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Maurice Williams
          Path:
          src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfiguration.java
          http://jenkins-ci.org/commit/parameterized-remote-trigger-plugin/a24f17511b12ee5e1c8caa2215f5a04e3d01fd3d
          Log:
          Merge pull request #3 from timbrown5/master

          Fix for JENKINS-22325

          Compare: https://github.com/jenkinsci/parameterized-remote-trigger-plugin/compare/f683d4ed0a45...a24f17511b12

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Maurice Williams Path: src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfiguration.java http://jenkins-ci.org/commit/parameterized-remote-trigger-plugin/a24f17511b12ee5e1c8caa2215f5a04e3d01fd3d Log: Merge pull request #3 from timbrown5/master Fix for JENKINS-22325 Compare: https://github.com/jenkinsci/parameterized-remote-trigger-plugin/compare/f683d4ed0a45...a24f17511b12
          Hide
          morficus Maurice W. added a comment -

          PR has been merged in.
          This will be part of the upcoming path/bug-fix release (scheduled for this weekend)

          Show
          morficus Maurice W. added a comment - PR has been merged in. This will be part of the upcoming path/bug-fix release (scheduled for this weekend)
          Hide
          morficus Maurice W. added a comment -

          this fix is part of the 2.1.2 release done on April 26th

          Show
          morficus Maurice W. added a comment - this fix is part of the 2.1.2 release done on April 26th
          Hide
          smperkins Shawn Perkins added a comment -

          How long does it typically take for the main repository to pick up the new release? I see that it still shows 2.1 as the version and I could use this fix. Thanks!

          Show
          smperkins Shawn Perkins added a comment - How long does it typically take for the main repository to pick up the new release? I see that it still shows 2.1 as the version and I could use this fix. Thanks!
          Hide
          jswager1 Jason Swager added a comment -

          I'm having this same problem. It looks like an update is supposed to be rolling out - but no trace of an update being available.

          Show
          jswager1 Jason Swager added a comment - I'm having this same problem. It looks like an update is supposed to be rolling out - but no trace of an update being available.
          Hide
          danielbeck Daniel Beck added a comment -

          Maurice W.: Looks like you hit a bug in maven release plugin when releasing (search the Jenkins mailing list for a fix). You uploaded a snapshot build instead of a proper release. There is no 2.1.2 release available for download.

          Release builds: http://repo.jenkins-ci.org/simple/releases/org/jenkins-ci/plugins/Parameterized-Remote-Trigger/
          Snapshot builds: http://repo.jenkins-ci.org/simple/snapshots/org/jenkins-ci/plugins/Parameterized-Remote-Trigger/

          Show
          danielbeck Daniel Beck added a comment - Maurice W. : Looks like you hit a bug in maven release plugin when releasing (search the Jenkins mailing list for a fix). You uploaded a snapshot build instead of a proper release. There is no 2.1.2 release available for download. Release builds: http://repo.jenkins-ci.org/simple/releases/org/jenkins-ci/plugins/Parameterized-Remote-Trigger/ Snapshot builds: http://repo.jenkins-ci.org/simple/snapshots/org/jenkins-ci/plugins/Parameterized-Remote-Trigger/
          Hide
          mskorna Maik Skorna added a comment -

          @Maurice W. please recheck your Release, we cannot find the 2.1.2 version under Releases.

          Show
          mskorna Maik Skorna added a comment - @Maurice W. please recheck your Release, we cannot find the 2.1.2 version under Releases.
          Hide
          morficus Maurice W. added a comment - - edited

          I was not aware of the maven-release-plugin bug - sorry for the inconvenience.

          Release 2.1.3 has been pushed, and I confirmed that it was correct this time (http://maven.jenkins-ci.org:8081/content/repositories/releases/org/jenkins-ci/plugins/Parameterized-Remote-Trigger)

          Show
          morficus Maurice W. added a comment - - edited I was not aware of the maven-release-plugin bug - sorry for the inconvenience. Release 2.1.3 has been pushed, and I confirmed that it was correct this time ( http://maven.jenkins-ci.org:8081/content/repositories/releases/org/jenkins-ci/plugins/Parameterized-Remote-Trigger )
          Hide
          morficus Maurice W. added a comment -

          Originally fixed back in April with version 2.1.2, but was never released because of a bug in the "maven release plugin" when using git 1.8.5.

          It should now be available in version 2.1.3

          Show
          morficus Maurice W. added a comment - Originally fixed back in April with version 2.1.2, but was never released because of a bug in the "maven release plugin" when using git 1.8.5. It should now be available in version 2.1.3
          Hide
          daniloichaves Danilo Ischiavolini Chaves added a comment -

          I have the same problem.

          Show
          daniloichaves Danilo Ischiavolini Chaves added a comment - I have the same problem.

            People

            • Assignee:
              morficus Maurice W.
              Reporter:
              mskorna Maik Skorna
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: