Checking if https page exists or not

We have a requirement to make sure that the page does actually exists or not. For http page it was as simple as

HttpURLConnection con = (HttpURLConnection) new URL(URLName)
.openConnection();
booleanValue=(con.getResponseCode() == HttpURLConnection.HTTP_OK);

But when I try to use the same logic for https page validation using HttpsUrlConnection object,

HttpsURLConnection con = (HttpsURLConnection) new URL(URLName)
.openConnection();
booleanValue=(con.getResponseCode() == HttpsURLConnection.HTTP_OK);

I get the following exception:

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

Currently, we have simply out of the box Rhythmyx server installed without any certs deployed in it.
Can someone please provide steps to resolve this issue?

thanks
Manvinder

Manvinder,

Add a certificate to implement SSL. You can probably get by using a self-signed certificate during while you are testing.

RLJII