<p>I am deploying sample springboot application using fabric8 maven deploy. The build fails with SSLHandshakeException.</p>

<pre><code>F8: Cannot access cluster for detecting mode: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Failed to execute goal io.fabric8:fabric8-maven-plugin:3.1.80.redhat-000010:build (default) on project fuse-camel-sb-rest: Execution default of goal io.fabric8:fabric8-maven-plugin:3.1.80.redhat-000010:build failed: An error has occurred. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -&gt; [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:fabric8-maven-plugin:3.1.80.redhat-000010:build (default) on project fuse-camel-sb-rest: Execution default of goal io.fabric8:fabric8-maven-plugin:3.1.80.redhat-000010:build failed: An error has occurred.
</code></pre>

<p>So, I downloaded the public certificate from the Openshift webconsole and added it to JVM using </p>

<pre><code>C:\...\jdk.\bin&gt;keytool -import -alias rootcert -file C:\sample\RootCert.cer -keystore cacerts
</code></pre>

<p>and got message that its successfully added to the keystore and the list command shows the certificates added.</p>

<pre><code>    C:\...\jdk.\bin&gt;keytool -list -keystore cacerts
Enter keystore password:
Keystore type: JKS
Keystore provider: SUN

Your keystore contains 2 entries

rootcert, May 18, 2018, trustedCertEntry,
Certificate fingerprint (SHA1): XX:XX:XX:..........
</code></pre>

<p>But the mvn:fabric8 deploy build still fails with the same exception.</p>

<p>Can someone shed some light on this issue? Am I missing anything?</p>

<p>The following works on MacOS:</p>

<p>The certificate to install is the one found on the browser URL bar;<br>
On Firefox (at least) click the padlock <a href="https://i.stack.imgur.com/5H4i9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5H4i9.png" alt="padlock icon"></a>  to the left of the URL, then proceed down <em>Connection ></em> / <em>More Information</em> / <em>View Certificate</em> / <em>Details</em>, finally <strong>Export...</strong> allows you to save the certificate locally.</p>

<p>On the command-line, determine which JRE maven is using:</p>

<pre><code>$ mvn --version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T19:33:14+01:00)
Maven home: /Users/.../apache-maven-3.5.4
Java version: 1.8.0_171, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
</code></pre>

<p>You will likely need to be 'root' to update the cacerts file. </p>

<pre><code>$ sudo keytool -import -alias my-openshift-clustername -file /Users/.../downloads/my-cluster-cert.crt -keystore $JAVA_HOME/jre/lib/security/cacerts
Password: {your password for sudo}
Enter keystore password: {JRE cacerts password, default is changeit}
... keytool prints certificate details...
Trust this certificate? [no]:  yes
Certificate was added to keystore
</code></pre>

<p>Verify that the certificate was indeed added successfully:</p>

<pre><code>$ keytool -list -keystore $JAVA_HOME/jre/lib/security/cacerts
Enter keystore password: changeit
Keystore type: JKS
Keystore provider: SUN

Your keystore contains 106 entries

...other entries, in no particular order...
my-openshift-clustername, 25-Feb-2019, trustedCertEntry,
Certificate fingerprint (SHA1): F4:17:3B:D8:E1:4E:0F:AD:16:D3:FF:0F:22:73:40:AE:A2:67:B2:AB
...other entries...
</code></pre>
