title: javax.net.ssl.SSLHandshakeException when connecting to gmail pop3 server
body: <p>I have some trouble when I try to connect to gmail POP3 server with javamail.</p>
  <p>My error is:</p>
  <blockquote>
  <p>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</p>
  </blockquote>
  <p>It's blocking at the store.connect line.</p>
  <p>Here is my code:</p>
  <pre><code>System.setProperty(&quot;javax.net.ssl.trustStore&quot;,&quot;C:\\Program Files (x86)\\Java\\jre1.8.0_66\\lib\\security\\cacerts&quot;);
          Properties prop = System.getProperties();
          prop.put(&quot;mail.pop3.socketFactory.class&quot;, &quot;javax.net.ssl.SSLSocketFactory&quot;);
          prop.put(&quot;mail.pop3.socketFactory.fallback&quot;, &quot;false&quot;);
          prop.put(&quot;mail.pop3.socketFactory.port&quot;, &quot;995&quot;);
          prop.put(&quot;mail.pop3.port&quot;, &quot;995&quot;);
          prop.put(&quot;mail.pop3.host&quot;, &quot;pop.gmail.com&quot;);
          prop.put(&quot;mail.pop3.user&quot;, username);
          prop.put(&quot;mail.store.protocol&quot;, &quot;pop3&quot;);
          sess = Session.getInstance(prop,new javax.mail.Authenticator() {
              protected PasswordAuthentication getPasswordAuthentication() {
                  return new PasswordAuthentication(username, pwd);
              }
          });
          System.out.println(&quot;Obtention d'un objet store&quot;);
          st = sess.getStore(&quot;pop3&quot;);
          st.connect(host, username, pwd); //Blocking HERE
  </code></pre>
  <p>I checked my path and it's ok so I don't understand what is the problem.</p>
  <p>Thank you for your help.</p>