Answers: <p>After upgrading Jenkins the issue was solved. It turned out that the issue was version related.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-10-20T19:40:37.473Z
Answers: 2017-10-20T19:40:37.473Z
Answers: 030
Body: <p>The jenkins-cli.jar has been downloaded.</p>
  
  <p>It is able to run.</p>
  
  <p>When one tries to check the syntax of a jenkinsfile by running <code>java -jar ~/Desktop/jenkins-cli.jar -s https://&lt;jenkins_url&gt; -noCertificateCheck declarative-linter &lt; Jenkinsfile</code> it results in:</p>
  
  <pre><code>Sep 27, 2017 10:46:18 AM hudson.cli.CLI _main
  INFO: Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
  Sep 27, 2017 10:46:34 AM hudson.cli.CLI$5 run
  WARNING: null
  java.io.IOException: Stream is closed
          at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3512)
          at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3486)
          at java.io.DataOutputStream.writeInt(DataOutputStream.java:197)
          at hudson.cli.PlainCLIProtocol$EitherSide.send(PlainCLIProtocol.java:188)
          at hudson.cli.PlainCLIProtocol$EitherSide.send(PlainCLIProtocol.java:195)
          at hudson.cli.PlainCLIProtocol$EitherSide$1.write(PlainCLIProtocol.java:215)
          at hudson.cli.CLI$5.run(CLI.java:699)
  </code></pre>
  
  <p>@Tensibai asked whether there is an authentication issue. Authentication was done, but it is unclear whether it was succesfull or not:</p>
  
  <pre><code>$ java -jar ~/Desktop/jenkins-cli.jar -noCertificateCheck -s https://&lt;jenkins url&gt; login --username &lt;username&gt; --password &lt;password&gt;
  Sep 27, 2017 10:57:17 AM hudson.cli.CLI _main
  INFO: Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
  </code></pre>
  
Comments: CC BY-SA 3.0
Comments: 2017-09-27T08:54:43.870Z
Comments: Seems your jenkins url refuse the connexion, doesn't it need an authentication ?
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-09-27T09:01:17.287Z
Comments: @Tensibai question has been updated
Comments: 030
Comments: CC BY-SA 3.0
Comments: 2017-09-27T09:06:05.840Z
Comments: Maybe: `java -jar ~/Desktop/jenkins-cli.jar -s https://<jenkins_url> -noCertificateCheck --username <username> --password <password> declarative-linter < Jenkinsfile` ? there's a bunch of blur about auth with different versions on [jenkins site](https://wiki.jenkins.io/display/JENKINS/Jenkins+CLI)
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-09-27T09:10:06.947Z
Comments: it returned the same null pointer and stack trace
Comments: 030
Comments: CC BY-SA 3.0
Comments: 2017-09-27T09:26:41.847Z
Comments: Version of the cli ? format of the url ?
Comments: Tensibai
Tags: <jenkins><linting>
Title: Why does the jenkins-cli.jar linting functionality not work?
UserDisplayName: 030
ThreadText: # Why does the jenkins-cli.jar linting functionality not work?
  
  (Asked by: username_0 on 2017-09-27)
  
  The jenkins-cli.jar has been downloaded.
  
  It is able to run.
  
  When one tries to check the syntax of a jenkinsfile by running `java -jar ~/Desktop/jenkins-cli.jar -s https://<jenkins_url> -noCertificateCheck declarative-linter < Jenkinsfile` it results in:
  
  ```
  Sep 27, 2017 10:46:18 AM hudson.cli.CLI _main
  INFO: Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
  Sep 27, 2017 10:46:34 AM hudson.cli.CLI$5 run
  WARNING: null
  java.io.IOException: Stream is closed
          at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3512)
          at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3486)
          at java.io.DataOutputStream.writeInt(DataOutputStream.java:197)
          at hudson.cli.PlainCLIProtocol$EitherSide.send(PlainCLIProtocol.java:188)
          at hudson.cli.PlainCLIProtocol$EitherSide.send(PlainCLIProtocol.java:195)
          at hudson.cli.PlainCLIProtocol$EitherSide$1.write(PlainCLIProtocol.java:215)
          at hudson.cli.CLI$5.run(CLI.java:699)
  
  ```
  
  @username_1 asked whether there is an authentication issue. Authentication was done, but it is unclear whether it was succesfull or not:
  
  ```
  $ java -jar ~/Desktop/jenkins-cli.jar -noCertificateCheck -s https://<jenkins url> login --username <username> --password <password>
  Sep 27, 2017 10:57:17 AM hudson.cli.CLI _main
  INFO: Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
  
  ```
  
  **Tags:** jenkins, linting
  
  > **Comments:**
  > **username_1**: Seems your jenkins url refuse the connexion, doesn't it need an authentication ?  
  > **username_0**: @username_1 question has been updated  
  > **username_1**: Maybe: `java -jar ~/Desktop/jenkins-cli.jar -s https://<jenkins_url> -noCertificateCheck --username <username> --password <password> declarative-linter < Jenkinsfile` ? there's a bunch of blur about auth with different versions on [jenkins site](https://wiki.jenkins.io/display/JENKINS/Jenkins+CLI)  
  > **username_0**: it returned the same null pointer and stack trace  
  > **username_1**: Version of the cli ? format of the url ?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-10-20. Score: 1 | Accepted answer
  
  After upgrading Jenkins the issue was solved. It turned out that the issue was version related.
  
  
  ---
  
  