java.net.ConnectException: Connection refused

Jenkins JIRA | hyrrokkin_m | 7 years ago
  1. 0

    I'm running Hudson 1.324 on Kubuntu Linux 9.10. I've set up SMTP server configuration and configured Hudson to send me email notifications of failed builds. This works, but it fails about 50% of the times with the following message (with anonymised addresses): Sending e-mails to: me@mydomain.com ERROR: Could not connect to SMTP host: smtp.mysmtpserver.nl, port: 25 javax.mail.MessagingException: Could not connect to SMTP host: smtp.mysmptserver.nl, port: 25; nested exception is: java.net.ConnectException: Connection refused at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370) at javax.mail.Service.connect(Service.java:275) at javax.mail.Service.connect(Service.java:156) at javax.mail.Service.connect(Service.java:105) at javax.mail.Transport.send0(Transport.java:168) at javax.mail.Transport.send(Transport.java:98) at hudson.tasks.MailSender.execute(MailSender.java:97) at hudson.tasks.Mailer.perform(Mailer.java:95) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:480) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:466) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:454) at hudson.model.Build$RunnerImpl.post2(Build.java:146) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:438) at hudson.model.Run.run(Run.java:1146) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:123) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384) at java.net.Socket.connect(Socket.java:542) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:230) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250) ... 18 more Finished: SUCCESS This is the same server I use for all my email traffic, and it never bounces like this. Also, sending a test email from Hudson always works. However, for the build messages, it fails 50% of the time. The SMTP set up does not use authentication other than IP-based, so no SSL/TLS/whatever is playing a role here. I have contacted the ISP but they do not bounce when you send too many messages within too short a time interval, and anyways the messages get sent with 1-2 minutes in between, so it is unlikely that this would trigger any anti-spam filter or something of the kind. The difficult part here is that it works sometimes, but sometimes not.

    Jenkins JIRA | 7 years ago | hyrrokkin_m
    java.net.ConnectException: Connection refused
  2. 0

    I'm running Hudson 1.324 on Kubuntu Linux 9.10. I've set up SMTP server configuration and configured Hudson to send me email notifications of failed builds. This works, but it fails about 50% of the times with the following message (with anonymised addresses): Sending e-mails to: me@mydomain.com ERROR: Could not connect to SMTP host: smtp.mysmtpserver.nl, port: 25 javax.mail.MessagingException: Could not connect to SMTP host: smtp.mysmptserver.nl, port: 25; nested exception is: java.net.ConnectException: Connection refused at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370) at javax.mail.Service.connect(Service.java:275) at javax.mail.Service.connect(Service.java:156) at javax.mail.Service.connect(Service.java:105) at javax.mail.Transport.send0(Transport.java:168) at javax.mail.Transport.send(Transport.java:98) at hudson.tasks.MailSender.execute(MailSender.java:97) at hudson.tasks.Mailer.perform(Mailer.java:95) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:480) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:466) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:454) at hudson.model.Build$RunnerImpl.post2(Build.java:146) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:438) at hudson.model.Run.run(Run.java:1146) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:123) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384) at java.net.Socket.connect(Socket.java:542) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:230) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250) ... 18 more Finished: SUCCESS This is the same server I use for all my email traffic, and it never bounces like this. Also, sending a test email from Hudson always works. However, for the build messages, it fails 50% of the time. The SMTP set up does not use authentication other than IP-based, so no SSL/TLS/whatever is playing a role here. I have contacted the ISP but they do not bounce when you send too many messages within too short a time interval, and anyways the messages get sent with 1-2 minutes in between, so it is unlikely that this would trigger any anti-spam filter or something of the kind. The difficult part here is that it works sometimes, but sometimes not.

    Jenkins JIRA | 7 years ago | hyrrokkin_m
    java.net.ConnectException: Connection refused
  3. 0

    What is the default Jenkins password?

    Stack Overflow | 4 years ago | HHC
    java.net.ConnectException: Connection refused
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    how to fix failed server certificate accept exception when using hudson to do "git svn rebase" periodically?

    Google Groups | 6 years ago | Forrest Xia
    java.net.ConnectException: Connection refused: connect

  1. Tahir 164 times, last 2 months ago
  2. treefolk 1 times, last 1 week ago
  3. kjhdofjosvs 20 times, last 1 week ago
  4. Andreas Häber 9 times, last 2 weeks ago
  5. Aria Pahlavan 2 times, last 2 weeks ago
44 more registered users
50 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.net.ConnectException

    Connection refused

    at java.net.PlainSocketImpl.socketConnect()
  2. Java RT
    Socket.connect
    1. java.net.PlainSocketImpl.socketConnect(Native Method)
    2. java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)
    3. java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)
    4. java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)
    5. java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
    6. java.net.Socket.connect(Socket.java:542)
    6 frames
  3. JavaMail API (compat)
    SMTPTransport.protocolConnect
    1. com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:230)
    2. com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
    3. com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
    4. com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
    4 frames
  4. JavaMail API
    Transport.send
    1. javax.mail.Service.connect(Service.java:275)
    2. javax.mail.Service.connect(Service.java:156)
    3. javax.mail.Service.connect(Service.java:105)
    4. javax.mail.Transport.send0(Transport.java:168)
    5. javax.mail.Transport.send(Transport.java:98)
    5 frames
  5. Hudson
    Executor.run
    1. hudson.tasks.MailSender.execute(MailSender.java:97)
    2. hudson.tasks.Mailer.perform(Mailer.java:95)
    3. hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
    4. hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:480)
    5. hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:466)
    6. hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:454)
    7. hudson.model.Build$RunnerImpl.post2(Build.java:146)
    8. hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:438)
    9. hudson.model.Run.run(Run.java:1146)
    10. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    11. hudson.model.ResourceController.execute(ResourceController.java:88)
    12. hudson.model.Executor.run(Executor.java:123)
    12 frames