简体   繁体   中英

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM