Created 06-30-2017 12:42 AM
30 Jun 2017 06:03:26,478 ERROR [alert-dispatch-1] EmailDispatcher:172 - Unable to dispatch notification via Email javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 587; nested exception is: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2055) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697) at javax.mail.Service.connect(Service.java:386) at javax.mail.Service.connect(Service.java:245) at javax.mail.Service.connect(Service.java:194) at javax.mail.Transport.send0(Transport.java:253) at javax.mail.Transport.send(Transport.java:124) at org.apache.ambari.server.notifications.dispatchers.EmailDispatcher.dispatch(EmailDispatcher.java:160) at org.apache.ambari.server.notifications.DispatchRunnable.run(DispatchRunnable.java:58) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710) at sun.security.ssl.InputRecord.read(InputRecord.java:527) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:543) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:348) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:236) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2019)
Created on 06-30-2017 01:11 AM - edited 08-17-2019 07:44 PM
While configuring SMTP notifications from ambari UI did you select the following checkbox?
Start TLS
.
Created 06-30-2017 12:46 AM
have already set mail.smtp.ssl.enable= true
Created on 06-30-2017 01:11 AM - edited 08-17-2019 07:44 PM
While configuring SMTP notifications from ambari UI did you select the following checkbox?
Start TLS
.
Created 06-30-2017 01:18 AM
Yes I did. screenshot attachedambari-email.png
Created 06-30-2017 04:17 AM
I just noticed that you added ["mail.smtp.ssl.enable":true] parameter in your SMTP protocol which is actually causing the issue.
Please remove that property and then it should not cause the following error any more. For smtp.gmail.com that property is not at all needed.
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710) at sun.security.ssl.InputRecord.read(InputRecord.java:527)
Created 06-30-2017 08:33 AM
the error changes after removing ["mail.smtp.ssl.enable":true]. see the screenshot. ambari-alert2.png
Created 06-30-2017 08:46 AM
This error indicates that you have not configured TrustStore for Ambari. Also you will need to store the "smtp.gmail.com" certificate in that truststore.
Please try this:
1). Create Ambari TrustStore File.
# export AMBARI_SERVER_HOSTNAME=erie1.example.com # cd /etc/ambari-server/conf/ # $JAVA_HOME/bin/keytool -genkeypair -alias ambari -keyalg RSA -validity 365 -keystore /etc/ambari-server/conf/$AMBARI_SERVER_HOSTNAME.jks -dname 'CN=$AMBARI_SERVER_HOSTNAME, OU=MiddlewareMagic, O=test, L=Bangalore, S=Karnataka, C=IN' -keypass ambari -storepass ambari
**NOTE** Please replace the "MBARI_SERVER_HOSTNAME" with your actual ambari server FQDN/hostname.
2) . Retrieve the "smtp.gmail.com" certificate in Ambari Trust Store.
# cd /etc/ambari-server/conf/ # openssl s_client -connect smtp.gmail.com:587 -starttls smtp <<< '' | openssl x509 -out gmail-smtp.cer
3). Import the smtp.gmail.com certificate to Ambari Truststore.
# $JAVA_HOME/bin/keytool -import -alias $AMBARI_SERVER_HOSTNAME -file /etc/ambari-server/conf/gmail-smtp.cer -keystore /etc/ambari-server/conf/$AMBARI_SERVER_HOSTNAME.jks
4). Configure Ambari TrustStore.
[root@erie1 conf]# ambari-server setup-security Using python /usr/bin/python Security setup options... =========================================================================== Choose one of the following options: [1] Enable HTTPS for Ambari server. [2] Encrypt passwords stored in ambari.properties file. [3] Setup Ambari kerberos JAAS configuration. [4] Setup truststore. [5] Import certificate to truststore. =========================================================================== Enter choice, (1-5): 4 Do you want to configure a truststore [y/n] (y)? The truststore is already configured. Do you want to re-configure the truststore [y/n] (y)? TrustStore type [jks/jceks/pkcs12] (jks):jks Path to TrustStore file :/etc/ambari-server/conf/erie1.example.com.jks Password for TrustStore: ambari Re-enter password: ambari Ambari Server 'setup-security' completed successfully. +++++++++++
5). Restart Ambari Server.
Created 06-30-2017 10:57 AM
@Jay SenSharma worked after creating truststore. Thanks a lot.