How to disable certficate validation

Is there a way, when connecting to a HTTPS site, to disable certificate validation, in order to avoid the following error: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

There is no way to disable certificate validation when connecting to a HTTPS site.