1

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
Marcello90
  • 1,313
  • 4
  • 18
  • 33

1 Answers1

1

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)

gerrytan
  • 40,313
  • 9
  • 84
  • 99
  • 1
    Hey, thanks for your answer. I was a bit confused because i modified nothing at the keystore. I solved the problem now. It was caused by Avast Antivirus. I disabled the virus check of outgoing smtp connections. I think Avast replaces the certificates to check the content of the mails or something like that. – Marcello90 Jan 20 '14 at 00:40
  • Hmm probably your antivirus is acting as a proxy so it can see the contents of data being exchanged, and since the traffic is SSL you get antivirus' certificate instead of Google's – gerrytan Jan 20 '14 at 22:32