Singam
Singam

Reputation: 503

Issue with using GMail SMTP from Payara 5 Java Mail

I have just written a test standalone Java Mail Application to send an email from my gmail A/C to the outlook one and it works like a charm. Below are the essential properties for the Mail Session:

props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.starttls.enable", "true");

However, moment I configure the same properties in the Glassfish 5 Java Email Session (on Admin console), I see the following error in the log, upon running the web application:

 StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NoSuchMethodError: sun.security.ssl.Handshaker.setApplicationProtocols([Ljava/lang/String;)V
    at sun.security.ssl.SSLSocketImpl.initHandshaker(SSLSocketImpl.java:1350)

PS - "Less secure app access" on Google A/C is set to ON for both the cases.

Puzzled! Any help would be greatly appreciated.

Upvotes: 0

Views: 380

Answers (0)

Related Questions