I am getting an exception while executing below code
public static void main( String[] args )
{
System.getProperties().put("https.proxyHost","www-proxy.idc.myproxy.com");
System.getProperties().put("https.proxyPort", "80");
System.setProperty( "javax.net.ssl.keyStore","D:\\motorweb.p12"); // The path to the .p12 file
System.setProperty( "javax.net.ssl.keyStorePassword","******"); // The password of the p12 file
System.setProperty( "javax.net.ssl.keyStoreType", "PKCS12" ); // Default is JKS, we're using PKCS12
try {
URL url = new URL( "https://*******************?reference=43888db2" );
// Parse the XML into a DOM tree
Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( url.openStream() );
// Serialize it out to the console
TransformerFactory.newInstance().newTransformer().transform( new DOMSource( document ), new StreamResult( System.out ) );
} catch ( Exception e ) {
e.printStackTrace();
}
}
It was working fine, but don't know what happen and its started giving me and error as below: refereed to similar post.. but dint got the solution i had not set any arguments at VM level.
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at javax.net.ssl.DefaultSSLSocketFactory.throwException(Unknown Source)
at javax.net.ssl.DefaultSSLSocketFactory.createSocket(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
I got the root cause of this error. while importing .p12 file its giving me and error as -->file is invalid for use as the following: Personal Information Exchange. how can i fix this?