Skip to Content
0
Former Member
Apr 21, 2011 at 10:22 AM

HttpsURLConnection URL connection issue

535 Views

Hi All,

I need to create URL connection with HTTPS URL. I can run Main java class successfully in machine which hosted in SAP Java server, but fail to run integrate it with e-commence application. When depployed in to SAP Java server cannot open HttpsURLConnection and always return CalssCastexception. However same code run as Java Main class

Is this can be a (SSL) Handshake? or is this SSL issue?

MyCode:

String httpsURL = "https://encrypted.google.com/";
    URL myurl = new URL(httpsURL);
    HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();
    InputStream ins = con.getInputStream();
    InputStreamReader isr = new InputStreamReader(ins);
    BufferedReader in = new BufferedReader(isr);

    String inputLine;

    while ((inputLine = in.readLine()) != null) {
      System.out.println(inputLine);
    }

    in.close();

Thank You