java.security.cert.CertificateException: Couldn't find trusted certificate
I had the following code to connect to a site on a server. The server is using https, which causes the error
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Couldn't find trusted certificate
I have saved the certificate for reference and I assume to I need to tell the program to look at that but this will happen every time there is a new certificate
Changing the HttpURLConnection object to HttpsURLConnection throws up a 'java.lang.ClassCastException' error coz its an abstract class..
Any ideas? Thanks.
java.util.Properties propSy = System.getProperties();
java.security.Provider myprov = java.security.Security.getProvider("SunJSSE");
URL url = new URL ( rptUrl );
c = (HttpsURLConnection)url.openConnection();
//set cache and request method settings
//set other headers
c.setRequestProperty ("Content-Type", "application/pdf");
//connect to the server..
import javax.net.ssl.*;import javax.net.*; :all these are not recognized!!!
Dear Eric and all members, am unable to run the selfsign.zip codes...am having same errors with other java applications using SSL.
In my codes itself, import.javax.net; import.net.SSL; import javax.security.cert.X509Certificate; all these are underlined red and is not recognized!
It says cannot be resolved to a type..do i need to include any package and library?!
I have done some research and am getting lots of different things on EAServer Client machine, jaguar server and so on..am quite confused!
Thanking you in advance and waiting for an early response!