0

When running the test file on my IDE on my local machine, I added the self-signed certificate to my JVM truststore by navigating to $JAVA_HOME/jre/lib/security and adding it using keytool. The error went away.

When I try the build on Jenkins, I get the same error again: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I'm trying to figure out how I would add the SSL cert path in Jenkins. If I run the commands in the pre-build steps, it doesn't work because adding a ssl cert requires the keystore password, and I'm not sure if there's a way to indicate what password you'd want to enter prior to running the pre-build steps.

coffeelemon
  • 11
  • 1
  • 4
  • 1
    Does this answer your question? ["PKIX path building failed" and "unable to find valid certification path to requested target"](https://stackoverflow.com/questions/21076179/pkix-path-building-failed-and-unable-to-find-valid-certification-path-to-requ) – Jens Oct 11 '22 at 15:52
  • I've already done those steps (similar ones, at least) and that fixed the error on my local machine. I'm getting the error when I do a Jenkins build now. I'm just not sure if Jenkins has the path to the certs and I'm not sure how to integrate that. – coffeelemon Oct 11 '22 at 15:56
  • Do you use a different jdk in the build than the jenkins itself – Jens Oct 11 '22 at 15:56
  • Not sure if this is what you mean, but the jdk version on my machine is version "16.0.2" and the one on Jenkins seems to be "11.0.16" under the global tool config page (I didn't setup the Jenkins stuff myself). – coffeelemon Oct 11 '22 at 16:14
  • If you read through the [other questions](https://stackoverflow.com/search?q=%5Bjenkins%5D+pkix+is%3Aquestion), you'd find one that says every java install has its own keystore, but also how to provide [specific values for Jenkins](https://stackoverflow.com/a/52842215/598141) instance. Guessing you probably have different Java within Jenkins to Jenkins itself or outside Jenkins. Check JAVA_HOME in `${JENKINSURL}/systemInfo`, `${JENKINSURL}/computer/{NODENAME}/systemInfo` and job exec shell step `echo $JAVA_HOME` against what you claim it to be – Ian W Oct 12 '22 at 07:36

0 Answers0