BindException: Cannot assign requested address: connect when setting Outgoing SMTP mail server in a JIRA application

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

After you finish setting up the Outgoing SMTP Mail Server in a JIRA application, while you try to test the connection the the following error appears:

The following stack traces appears in the atlassian-jira.log:

2013-07-25 15:00:36,343 http-bio-8080-exec-16 ERROR test 900x1185x1 11bp8rq 192.168.0.105 /secure/admin/VerifySmtpServerConnection!update.jspa [plugins.mail.webwork.VerifyMailServer] Unable to connect to the server at test.mail.smtp due to the following exception: java.net.BindException: Cannot assign requested address: connect

The following stack traces appears in the atlassian-jira-outgoing-mail.log:

An error has occurred with sending the test email:
com.atlassian.mail.MailException: javax.mail.MessagingException: Could not connect to SMTP host: , port: 25;
  nested exception is:
	java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine
	at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:201)
	at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:149)
	at com.atlassian.jira.plugins.mail.webwork.SendTestMail.doExecute(SendTestMail.java:107)
	at webwork.action.ActionSupport.execute(ActionSupport.java:165)
	at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:87)
	at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:39)
	at webwork.interceptor.NestedInterceptorChain.proceed(NestedInterceptorChain.java:31)
	...
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: , port: 25;
  nested exception is:
	java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1972)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
	at javax.mail.Service.connect(Service.java:295)
	...
Caused by: java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine
	at java.net.DualStackPlainSocketImpl.connect0(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)

Diagnosis

  • Try to verify whether the host name of the SMTP mail server is correct or not.
  • Check on the credential for the SMTP mail server make sure the username and password is correct
  • Use netcat or telnet(deprecated) to test the connection to the SMTP mail server and determine if it can be established.

Cause

SMTP host name is invalid or there is some restriction that block JIRA applications to connect to the SMTP host name. On Windows 8 this exception is known to be thrown due to problems with Java trying to use the IPv6 address.

Resolution

Most probably there is anti-virus and firewall installed in the JIRA applications host machine that is blocking the host name of the SMTP mail server. Try to double check on the inbound and outbound rules on both anti-virus and firewall and set exception for the SMTP host name.

Windows 8 Only:

  1. Stop JIRA applications.
  2. Add the following argument to the JVM as per Setting Properties and Options on Startup:

    -Djava.net.preferIPv4Stack=true
  3. Start JIRA applications.

Last modified on Mar 10, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.