Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Ambari-Alerts configuration error- Not able to receive alert email. Below is the output of ambari-server.log. "telnet smtp.gmail.com 587" is getting connected.

Solved Go to solution
Highlighted

Ambari-Alerts configuration error- Not able to receive alert email. Below is the output of ambari-server.log. "telnet smtp.gmail.com 587" is getting connected.

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)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Ambari-Alerts configuration error- Not able to receive alert email. Below is the output of ambari-server.log. "telnet smtp.gmail.com 587" is getting connected.

Super Mentor

@Mohit Varshney

While configuring SMTP notifications from ambari UI did you select the following checkbox?

Start TLS

17584-ambari-smtp.png

.

View solution in original post

7 REPLIES 7
Highlighted

Re: Ambari-Alerts configuration error- Not able to receive alert email. Below is the output of ambari-server.log. "telnet smtp.gmail.com 587" is getting connected.

have already set mail.smtp.ssl.enable= true

Highlighted

Re: Ambari-Alerts configuration error- Not able to receive alert email. Below is the output of ambari-server.log. "telnet smtp.gmail.com 587" is getting connected.

Super Mentor

@Mohit Varshney

While configuring SMTP notifications from ambari UI did you select the following checkbox?

Start TLS

17584-ambari-smtp.png

.

View solution in original post

Re: Ambari-Alerts configuration error- Not able to receive alert email. Below is the output of ambari-server.log. "telnet smtp.gmail.com 587" is getting connected.

@Jay SenSharma

Yes I did. screenshot attachedambari-email.png

Highlighted

Re: Ambari-Alerts configuration error- Not able to receive alert email. Below is the output of ambari-server.log. "telnet smtp.gmail.com 587" is getting connected.

Super Mentor

@Mohit Varshney

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)

.

Highlighted

Re: Ambari-Alerts configuration error- Not able to receive alert email. Below is the output of ambari-server.log. "telnet smtp.gmail.com 587" is getting connected.

@Jay SenSharma

the error changes after removing ["mail.smtp.ssl.enable":true]. see the screenshot. ambari-alert2.png

Highlighted

Re: Ambari-Alerts configuration error- Not able to receive alert email. Below is the output of ambari-server.log. "telnet smtp.gmail.com 587" is getting connected.

Super Mentor

@Mohit Varshney

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.

.

Highlighted

Re: Ambari-Alerts configuration error- Not able to receive alert email. Below is the output of ambari-server.log. "telnet smtp.gmail.com 587" is getting connected.

@Jay SenSharma worked after creating truststore. Thanks a lot.

Don't have an account?
Coming from Hortonworks? Activate your account here