1

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?

Vishal
  • 549
  • 1
  • 4
  • 21
  • The domain `www-proxy.idc.myproxy.com` is for sale. It might just be that the proxy service you were using stopped working. – Steffen Ullrich Jul 21 '15 at 05:58
  • actually i just have random one for post.. i am setting it to my office proxy.. – Vishal Jul 21 '15 at 06:21
  • 2
    Please use names for examples which are reserved for this purpose (i.e. *.example.com, *.example.org) and don't make up names which conflict with real names. Apart from that: "It was working fine, but don't know what happen" - find out what has been changed (i.e. network, proxy, Java version, server ...) – Steffen Ullrich Jul 21 '15 at 06:42
  • only thing i did is i executed.. code to import certificate to key store. code-->https://github.com/escline/InstallCert – Vishal Jul 21 '15 at 07:12
  • http://stackoverflow.com/questions/6365209/java-and-ssl-java-security-nosuchalgorithmexception might be of help – Steffen Ullrich Jul 21 '15 at 07:29
  • added those debug lines.. just added this details to console--> keyStore is : D:\motorweb.p12 keyStore type is : PKCS12 keyStore provider is : init keystore default context init failed: java.io.IOException: toDerInputStream rejects tag type -32 – Vishal Jul 21 '15 at 08:39
  • also i am not able to import the certificate to browser.. issue is only on my machine.. gives me an error-->file is invalid for use as the following: Personal Information Exchange – Vishal Jul 21 '15 at 08:40
  • Please post the *entire* stack trace. Don't just tell us about it. – user207421 Jul 21 '15 at 09:51
  • @EJP error stack trace already pasted in question.. error about installing/importing .p12 file to browser will get when i double click on it.. – Vishal Jul 22 '15 at 03:48

0 Answers0