Saturday, June 07, 2014

javax.mail.MessagingException: Could not convert socket to TLS

This error happened after we migrated Jenkins to a bigger server. The configurations were alike and the mail server configured was internal. Apparently there were no mail changes so why the error I don't have a clue. I ended up authorizing the domain.
Solution:
========
#In tomcat/bin/setenv.sh use the the last property below:
java ... -Dmail.smtp.starttls.enable=true -Dmail.smtp.ssl.trust=mail.server.domain ...
Problem:
=======
Failed to send out e-mail
javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1880)
...
Caused by: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:198)
...
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at java.security.Provider$Service.newInstance(Provider.java:1262)
...
Caused by: java.security.PrivilegedActionException: java.io.FileNotFoundException: /opt/tomcat/certs/DLWSCert.p12 (No such file or directory)
at java.security.AccessController.doPrivileged(Native Method)
...
Caused by: java.io.FileNotFoundException: /opt/tomcat/certs/DLWSCert.p12 (No such file or directory)
at java.io.FileInputStream.open(Native Method)

2 comments:

Kuldeep Singh said...

Try this props.put("mail.smtp.starttls.enable", "true");

Nestor Urquiza said...

@Kuldeep that option was already in use and it was still failing.

Followers