IBM Support

javax.mail.MessagingException: Could not connect to SMTP host

Troubleshooting


Problem

When TDI 7.1.1 or SDI 7.2 use IBM JRE 7 the following exception will appear, when either system.sendMail() or SendEMailFC are used to send email.

Symptom

On Assemblyline execution, the system.sendMail() produces the following error:

DEBUG SMTP: trying to connect to host "na.relay.ibm.com", port 25, isSSL false
CTGDIS399I Unable to send mail.Exception occurred: javax.mail.MessagingException: Could not connect to SMTP host: na.relay.ibm.com, port: 25;
nested exception is:
java.net.SocketException: Network is unreachable: connect



On Assemblyline execution, the SendEMailFC produces the following error:

javax.mail.MessagingException: Could not connect to SMTP host: 10.10.10.1, port: 25;
nested exception is:
java.net.SocketException: Network is unreachable: connect
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 com.ibm.di.fc.SendEMailFC.perform(SendEMailFC.java:519)
at com.ibm.di.server.AssemblyLineComponent.executeOperation(AssemblyLineComponent.java:3370)
at com.ibm.di.server.FunctionComponent.callreply(FunctionComponent.java:304)
at com.ibm.di.server.AssemblyLine.msExecuteNextConnector(AssemblyLine.java:3813)
at com.ibm.di.server.AssemblyLine.executeMainStep(AssemblyLine.java:3404)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:3012)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:2995)
at com.ibm.di.server.AssemblyLine.executeAL(AssemblyLine.java:2964)
at com.ibm.di.server.AssemblyLine.run(AssemblyLine.java:1328)
Caused by: java.net.SocketException: Network is unreachable: connect

Cause

It's possible IBM JVM 7 is defaulting to the IPv6 protocol.

Resolving The Problem

Available options to implement:
In the solution.properties file, find, un-comment, and set 'java.net.preferIPv4Stack=true'
or
Call system.setProperty("java.net.preferIPv4Stack" , "true") before calling system.sendMail()
or
In the SendEMailFC / After Initialize Hook, add system.setProperty("java.net.preferIPv4Stack" , "true")

Related Information

[{"Product":{"code":"SSCQGF","label":"Tivoli Directory Integrator"},"Business Unit":{"code":"BU008","label":"Security"},"Component":"General","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.1.1;7.2","Edition":"","Line of Business":{"code":"LOB24","label":"Security Software"}}]

Document Information

More support for:
Tivoli Directory Integrator

Software version:
7.1.1, 7.2

Operating system(s):
Windows

Document number:
710173

Modified date:
21 June 2018

UID

swg21688202