https://kotlinlang.org logo
#http4k
Title
# http4k
g

Gopal S Akshintala

05/08/2022, 2:47 PM
Hi, I am facing a classic java cert issue
PKIX path building failed
. I migrated from
JavaHttpClient()
to
ApacheClient()
and built it like this to disable SSL verification. Yet getting the same issue. What am I missing?
Copy code
Apache4Client(
          client = HttpClients.custom()
            .setDefaultRequestConfig(
              RequestConfig.custom()
                .setRedirectsEnabled(false)
                .setCookieSpec(CookieSpecs.IGNORE_COOKIES)
                .build()
            ).setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
            .build()
        )
This is the exception log:
Copy code
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:370)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:313)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:654)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:473)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:369)
	at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:480)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:458)
	at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:200)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1500)
Attached full log in the thread. Here is my usage (it’s a small app): https://github.com/overfullstack/revoman-root/blob/f43bc461e580eae650c84ce179645423118e1eba/src/jvmMain/kotlin/org/revcloud/ReVoman.kt#L84-L84
167 Views