For integration testing of my xmpp stack I set up a vysper server (0.7) on localhost.
Now I want to connect to the server using smack-core and smack-tcp in version 4.0.2.
Problem:
Caused by: javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Since the smack 4 api has changed a lot, the examples found so far can not be used anymore.
Anyone tried this before?
The SSLHandashskeException
tells us that the SSL/TLS handshake has failed, which is because there was a ValidatorException
that tells us that the "PKIX path building failed", because there was a SunCertPathBuilderException
thrown because the Java API was "unable to find valid certification path to requested target".
The Java API (ie. this is not done by Smack) could not build a valid certificate chain to the servers SSL/TLS certificate with the active SSLContext. That is why this exception is thrown. You need to provide either a valid certifcate (however that is defined by your currently used SSLContext) or tell Smack to use a SSLContext (ConnectionConfiguration.setCustomSSLContext(SSLContext)
) that accepts your current server certificate