javax.net.ssl.SSLHandshakeException: PKIX path building failed when QTest REST API uses self‑signed certificate
0 reputation · 02 Dec 2025, 19:06 UTC
0 reputation · 02 Dec 2025, 19:06 UTC
When QTest tries to call its REST endpoint over HTTPS using a self‑signed or otherwise untrusted certificate, the Java HTTP client throws a javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed error. This prevents the integration from authenticating and makes the API unusable.
Similarly, if the hostname cannot be resolved, QTest logs a generic Failed to resolve host: <hostname> exception from Apache HttpClient. The error is buried in the client stack and often appears as a silent failure.
QTest’s REST client hard‑codes the SSL context to the default JVM truststore and does not expose any option to supply a custom truststore or disable certificate validation. The only workaround is to modify the global JVM truststore or proxy the API through a trusted gateway.
It remains unclear whether QTest will ever provide a configuration hook for a custom truststore or allow SSL verification to be turned off. This limitation forces users to balance security with operational feasibility.
35275 reputation · 03 Dec 2025, 00:48 UTC
The javax.net.ssl.SSLHandshakeException: PKIX path building failed occurs because QTest’s Java client loads the JVM’s default truststore, which does not contain the self‑signed certificate presented by the QTest server. The client offers no exposed configuration to inject a custom truststore or to turn off validation, so the only ways to get past the exception are:
javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword when launching the QTest process. This supplies a trusted store without touching the global cacerts file.SSLContext that loads a user‑supplied truststore or a permissive TrustManager. This requires source access and a rebuild.QTest’s REST client constructs its SSLContext by calling SSLContext.getInstance("TLS") and then init with null parameters, which causes the JVM to use the default TrustManagerFactory. That factory consults the system property javax.net.ssl.trustStore or falls back to cacerts. Because the self‑signed certificate is absent from those stores, the PKIX path validation fails.
-Djavax.net.ssl.trustStore=… and -Djavax.net.ssl.trustStorePassword=… is a standard, documented way to override the default truststore for any Java application that relies on the default SSLContext.TrustManager) removes all cryptographic guarantees and is strongly discouraged outside of isolated testing environments.openssl s_client -connect qtest.example.com:443 -showcerts > qtest.cert.pem
keytool -import -file qtest.cert.pem -keystore qtest-truststore.jks -storepass changeit -alias qtest
java -Djavax.net.ssl.trustStore=/path/to/qtest-truststore.jks \
-Djavax.net.ssl.trustStorePassword=changeit \
-jar qtest.jar
SSLHandshakeException should no longer appear.
# NGINX configuration snippet
server {
listen 443 ssl;
server_name qtest.internal;
ssl_certificate /etc/ssl/certs/valid.crt;
ssl_certificate_key /etc/ssl/private/valid.key;
location / {
proxy_pass https://qtest.example.com;
proxy_ssl_certificate /etc/ssl/certs/qtest.cert.pem;
proxy_ssl_certificate_key /etc/ssl/private/qtest.key;
}
}
To refine the recommendation, could you confirm which QTest version you are running and whether you have access to the source code or can set JVM arguments at launch? The ability to pass -Djavax.net.ssl.trustStore or to patch the client determines the most straightforward solution.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.