Send Email step Fails on AWS cloud
search cancel

Send Email step Fails on AWS cloud

book

Article ID: 247680

calendar_today

Updated On:

Products

CA Application Test Service Virtualization

Issue/Introduction

When using a Send Email step in a test case it runs fine locally on WIndows/Mac OS but fails with the below error on AWS cloud.

============================================================================
| Failed to send email, error message = Sending the email to the following server failed : mail.host.com:465
============================================================================
| Step:        Send Email Step
----------------------------------------------------------------------------
| Message:     Sending the email to the following server failed : mail.host.com:465
----------------------------------------------------------------------------
| Trapped Exception: Sending the email to the following server failed : mail.host.com:465
| Trapped Message:   org.apache.commons.mail.EmailException: Sending the email to the following server failed : mail.host.com:465
----------------------------------------------------------------------------
STACK TRACE
org.apache.commons.mail.EmailException: Sending the email to the following server failed : mail.host.com:465
 at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)
 at org.apache.commons.mail.Email.send(Email.java:1496)
 at com.itko.lisa.glass.SendEmailExecutor.sendEmail(SendEmailExecutor.java:136)
 at com.itko.lisa.glass.SendEmailStep.execute(SendEmailStep.java:123)
 at com.itko.lisa.test.TestNode.executeNode(TestNode.java:995)
 at com.itko.lisa.test.TestCase.execute(TestCase.java:1297)
 at com.itko.lisa.test.TestCase.execute(TestCase.java:1198)
 at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1183)
 at com.itko.lisa.test.TestCase.executeTest(TestCase.java:1124)
 at com.itko.lisa.coordinator.Instance.run(Instance.java:208)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: mail.apple.com, port: 465;
  nested exception is:
 javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2120)
 at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:712)
 at javax.mail.Service.connect(Service.java:388)
 at javax.mail.Service.connect(Service.java:246)
 at javax.mail.Service.connect(Service.java:195)
 at javax.mail.Transport.send0(Transport.java:254)
 at javax.mail.Transport.send(Transport.java:124)
 at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459)
 ... 9 more
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
 at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
 at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
 at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:316)
 at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:310)
 at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1639)
 at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:223)
 at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
 at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
 at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
 at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
 at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
 at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
 at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:598)
 at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:372)
 at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:217)
 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2084)
 ... 16 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
 at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397)
 at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302)
 at sun.security.validator.Validator.validate(Validator.java:262)
 at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:330)
 at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:237)
 at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
 at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1621)
 ... 27 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
 at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
 at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
 at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
 at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)

Environment

Release : 10.6

Component : DevTest Application Test

Cause

The root cause is to be lack of truststore in Simulator with the PUBLIC CA Certs of mail.xxxx.com server. 

 

Resolution

Create a JKS file with the public cert of the mail.host.com and also the issuing CA Certs (2 levels, Root and Intermediate). Then made changes to Simulator POD by editing custom-values.xml file and adding the below two properties to JAVA_OPTS:
. javax.net.ssl.trustStore: Path to the JKS file
. javax.net.ssl.trustStorePassword: Trustore password
 
and restart the Simulator pod should trigger an email from the Send Email step in the test case.
 

Additional Information

In case test runs multiple times (Multiple Instances/Cycles) and see the below error for the second iteration
--------
Trapped Exception: The MimeMessage is already built.
| Trapped Message:   java.lang.IllegalStateException: The MimeMessage is already built.
-----------------
 
The above error is resolved by configuring the“Scope” setting in the Email Asset to "Step". Knowledge article Receive error when sending multiple emails in a test case will provide the resolution information.