Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error: javax.net.ssl.SSLHandshakeException : sun.security.validator.Validat

843833Jun 7 2010 — edited Jun 7 2010
Hi there,

I am trying to make an outside SSL connection but keep getting error as follows. I looked up google but could not find any solution.
try {


// Create new URL and connect
                        Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
			System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
			System.setProperty("javax.net.ssl.keyStore","C:\\Program Files\\Java\\j2re1.4.2_05\\lib\\security\\cacerts");
			System.setProperty("javax.net.ssl.keyStoreType",KeyStore.getDefaultType());
			System.setProperty("javax.net.ssl.keyStorePassword","changeit");
			System.setProperty("javax.net.ssl.trustStore", "C:\\Program Files\\Java\\j2re1.4.2_05\\lib\\securitycacerts");
			System.setProperty("javax.net.ssl.trustStoreType",KeyStore.getDefaultType());
			System.setProperty("javax.net.ssl.trustStorePassword", "changeit");

URL url = new URL("https://gateway.......");

HttpURLConnection connection = (HttpURLConnection) url.openConnection();

// Setup HTTP POST parameters
// throws error if doOutput=false
connection.setDoOutput(true);
//complete request
// Get OutPut stream to send xml request to fedex.
OutputStream out = connection.getOutputStream();
//post xml data request to output stream.
out.write(XMLRequest.getBytes());

String fedexResponse = "";
try {	
//now read the response from Fedex				
try {

//fedexresponse = caFedexRates.readFedExResponse(connection.getInputStream());
//System.out.println(connection.getInputStream());

BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine = null;
System.out.println("****************************************************************************");
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close(); 
System.out.println("****************************************************************************");								

} catch (Exception e)	{
System.out.println("Error while reading Fedex Response:"  +e);+
+}+


+} catch (Exception e) {+
+System.out.println("** *Error in reading Fedex Response: "+  e);
} // end of inside try-catch

} catch (Exception e) {
System.out.println(" *Error in making connection to Outside SSL: " + e);*
*}*
*
*

this is the error I am getting.
*
*
 * Error in making connection to Outside SSL: javax.net.ssl.SSLHandshakeException
: sun.security.validator.ValidatorException: No trusted certificate found
Can someone please help how to resolve this issue?

Thanks.

Edited by: techie_guru on Jun 7, 2010 10:34 AM

Edited by: techie_guru on Jun 7, 2010 10:40 AM

Edited by: techie_guru on Jun 7, 2010 10:41 AM

Edited by: techie_guru on Jun 7, 2010 10:41 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 5 2010
Added on Jun 7 2010
0 comments
330 views