java.net.ConnectException

tip

Check if your server (or a proxy server) is not going up and down. There might be something between a proxy and a client sending intermittent requests to non-functioning hosts as well. There might as well be too many requests in a short amount of time.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • I use Jenkins 1.397. When I start jobs on slaves (jnlp-slaves and windows-service-slaves) sometimes I get following error, so that I have to restart the build multiple times until the exception does not appear. {quote} [ak4.main.branch-4.3-M1-BSF] $ java -Xmx1024M -Dfile.encoding=Cp850 -cp C:\Jenkins\maven-agent.jar;C:\Jenkins\classworlds.jar hudson.maven.agent.Main "C:\Program Files (x86)\Entwicklung\apache-maven-2.1.0" C:\Users\mkr.ARCHIKART\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\20\22feb5d4-6a7aca32 C:\Jenkins\maven-interceptor.jar 80 C:\Jenkins\maven2.1-interceptor.jar Exception in thread "main" java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.<init>(Unknown Source) at java.net.Socket.<init>(Unknown Source) at hudson.maven.agent.Main.main(Main.java:124) at hudson.maven.agent.Main.main(Main.java:62) {quote} When it succeeds there messages like: {quote} [ak4.main.branch-4.3-M1-BSF] $ java -Xmx1024M -Dfile.encoding=Cp850 -cp C:\Jenkins\maven-agent.jar;C:\Jenkins\classworlds.jar hudson.maven.agent.Main "C:\Program Files (x86)\Entwicklung\apache-maven-2.1.0" C:\Users\mkr.ARCHIKART\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\20\22feb5d4-6a7aca32 C:\Jenkins\maven-interceptor.jar 55046 C:\Jenkins\maven2.1-interceptor.jar {quote} As I understand the logs, the Jenkins slave is instructed to communicate with Jenkins server on Port 80. But on port 80 there is another application running on the maschine, that contains Jenkins server. So possible solutions would be to retry with another port, configure a list of ports to be avoided or configure a range of ports to be used.
    via by namue,
  • I use Jenkins 1.397. When I start jobs on slaves (jnlp-slaves and windows-service-slaves) sometimes I get following error, so that I have to restart the build multiple times until the exception does not appear. {quote} [ak4.main.branch-4.3-M1-BSF] $ java -Xmx1024M -Dfile.encoding=Cp850 -cp C:\Jenkins\maven-agent.jar;C:\Jenkins\classworlds.jar hudson.maven.agent.Main "C:\Program Files (x86)\Entwicklung\apache-maven-2.1.0" C:\Users\mkr.ARCHIKART\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\20\22feb5d4-6a7aca32 C:\Jenkins\maven-interceptor.jar 80 C:\Jenkins\maven2.1-interceptor.jar Exception in thread "main" java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.<init>(Unknown Source) at java.net.Socket.<init>(Unknown Source) at hudson.maven.agent.Main.main(Main.java:124) at hudson.maven.agent.Main.main(Main.java:62) {quote} When it succeeds there messages like: {quote} [ak4.main.branch-4.3-M1-BSF] $ java -Xmx1024M -Dfile.encoding=Cp850 -cp C:\Jenkins\maven-agent.jar;C:\Jenkins\classworlds.jar hudson.maven.agent.Main "C:\Program Files (x86)\Entwicklung\apache-maven-2.1.0" C:\Users\mkr.ARCHIKART\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\20\22feb5d4-6a7aca32 C:\Jenkins\maven-interceptor.jar 55046 C:\Jenkins\maven2.1-interceptor.jar {quote} As I understand the logs, the Jenkins slave is instructed to communicate with Jenkins server on Port 80. But on port 80 there is another application running on the maschine, that contains Jenkins server. So possible solutions would be to retry with another port, configure a list of ports to be avoided or configure a range of ports to be used.
    via by namue,
  • ConnectException (Windows only)
    via by Oli,
  • faq [Dinamica EGO]
    via by Unknown author,
  • Java Socket exception
    via Stack Overflow by Monojeet Nayak
    ,
    • java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.<init>(Unknown Source) at java.net.Socket.<init>(Unknown Source) at hudson.maven.agent.Main.main(Main.java:124) at hudson.maven.agent.Main.main(Main.java:62)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    CasperCasper
    6 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    820 more bugmates