Marcello90
Marcello90

Reputation: 1343

GlassFish 4 and Java Mail: PKIX path building failed

i tried this tutorial (http://czetsuya-tech.blogspot.de/2012/11/how-to-send-email-in-glassfish-using.html). I am using GlassFish 4 on Windows 7 Professional 64-bit.

Is this tutorial working because i got this exception:

javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.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

Upvotes: 1

Views: 626

Answers (1)

gerrytan
gerrytan

Reputation: 41133

Have you tampered / modified $JAVA_HOME/jre/lib/security/cacerts file? If so try re-installing jdk. That keystore is normally where the trust certificate came from, and google's trust certificate should be accepted by default.

Beware also of other JVM env var that might discard standard certificates. (eg: -Djavax.net.ssl.trustStore)

Upvotes: 1

Related Questions