title: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No X509TrustManager implementation available
body: <p>I have code in my application that try to connect to an external host using HTTPS with a specified certificate.</p>
  
  <p>My code looks like this: </p>
  
  <pre><code>    //Load Two Keystores
      KeyStore keystore = KeyStore.getInstance("pkcs12", "SunJSSE");
      InputStream keystoreInput = new FileInputStream(cerPath);
      keystore.load(keystoreInput, passwd.toCharArray());
      System.out.println("Keystore has " + keystore.size() + " keys");
  
      // load the truststore, leave it null to rely on cacerts distributed with the JVM
      KeyStore truststore = KeyStore.getInstance("pkcs12", "SunJSSE");
      InputStream truststoreInput = new FileInputStream(cerPath);
      truststore.load(truststoreInput, passwd.toCharArray());
      System.out.println("Truststore has " + truststore.size() + " keys");
  
      //ssl context
      SSLContext sslcontext = SSLContext.getInstance("TLS");
      sslcontext.init(null, null, null);
      SSLSocketFactory sf = new SSLSocketFactory(keystore, passwd);
      Scheme https = new Scheme("https", 443, sf);
  
      SchemeRegistry schemeRegistry = new SchemeRegistry();
      schemeRegistry.register(https);
      ...
      client = new DefaultHttpClient(new PoolingClientConnectionManager(schemeRegistry));
      ...
      HttpResponse httpResponse = client.execute( targetHost, httpMethod);
  </code></pre>
  
  <p>The variable cerPath contains the path to the certificate (xxxx.pfx) used to establish the connection.</p>
  
  <p>In a standalone application, this works perfectly, but in my spring-boot application, the same code throws this exception:</p>
  
  <pre><code>javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No X509TrustManager implementation available
  </code></pre>
  
  <p>I've tested this code inside a normal Spring application, and it works too.</p>
  
  <p>The normal SSL properties () don't work either.</p>