sun.security.provider.certpath.SunCertPathBuilderException when update Akka HTTP to 10.1.14 to 10.2.4

I’m updating Akka HTTP from 10.1.14 to 10.2.4. Unfortunately, I’m having an exception that before was not present.

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

What I changed is the API deprecated, in particular for HttpsClient this :

http.setDefaultClientHttpsContext(newHttpsConnectionContext(sslContext.get))
...
...
def newHttpsConnectionContext(sslContext: SSLContext): HttpsConnectionContext = {
    val sslParameters: Option[SSLParameters] = None
    val sslConnectionContext: HttpsConnectionContext = ConnectionContext.https(
        sslContext,
        None,
        Some(SSL_CIPHER_SUITES.toIndexedSeq),
        Some(SSL_PROTOCOLS.toIndexedSeq),
        clientAuth,
        sslParameters
        )
}

into this :

http.setDefaultClientHttpsContext(newHttpsConnectionContext(sslContext.get))
...
...
def newHttpsConnectionContext(sslContext: SSLContext): HttpsConnectionContext = {
    val sslConnectionContext: HttpsConnectionContext = ConnectionContext.httpsClient(
    sslContext
    )
}

I would specify that sslContext variable , created previously trough a routine, is set in this way:

sslContext.init(km, tm, new SecureRandom())

where km and tm are custom KeyManager and TrustManager created at runtime starting from a certificate and a private key in pem format.

Could someone help me?