Using this tutorial, I am trying to run Jenkins cli in a windows 10 laptop as shown below. But, I am getting an exception. How do I find out why the exception occurs and how to fix it ?
Note that I first ran my jenkins.war on port 9090. Then, I moved it into tomcat webapps. Tomcat runs on port 8080.
C:\mystuff\jenkins-cli>java -jar jenkins-cli.jar -s http://localhost:9090/
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291)
at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:71)
at hudson.cli.CLI.plainHttpConnection(CLI.java:279)
at hudson.cli.CLI._main(CLI.java:271)
at hudson.cli.CLI.main(CLI.java:83)
You should check the exact url and address of the Jenkins instance inside your tomcat.
If you can access the web UI at, for example, http://localhost:8080/jenkins you should run your client as:
java -jar jenkins-cli.jar -s http://localhost:8080/jenkins/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With