sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection

Error java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection at com.chillyfacts.com.Send_HTTP_Request.call_me(Send_HTTP_Request.java:21) at com.chillyfacts.com.Send_HTTP_Request.main(Send_HTTP_Request.java:13) You might be using URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); Solution,Convert it to http protocol URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); See the Example shown in this link, https://chillyfacts.com/java-send-http-getpost-request-and-read-json-response/

Continue reading

Download java-json.jar

Download java-json.jar The contents are shown below META-INF/MANIFEST.MF org.json.CDL.class org.json.CDL.java org.json.Cookie.class org.json.Cookie.java org.json.CookieList.class org.json.CookieList.java org.json.HTTP.class org.json.HTTP.java org.json.HTTPTokener.class org.json.HTTPTokener.java org.json.JSONArray.class org.json.JSONArray.java org.json.JSONException.class org.json.JSONException.java org.json.JSONML.class org.json.JSONML.java org.json.JSONObject.class org.json.JSONObject.java org.json.JSONString.class org.json.JSONString.java org.json.JSONStringer.class org.json.JSONStringer.java org.json.JSONTokener.class org.json.JSONTokener.java org.json.JSONWriter.class org.json.JSONWriter.java org.json.XML.class org.json.XML.java org.json.XMLTokener.class org.json.XMLTokener.java Download Here. After downloading please extract the downloaded file. java-json.zip Check the below link to add the …

Continue reading

JAVA- Send HTTP Get/Post Request and Read JSON response

This tutorial shows how to send HTTP Get Request using java and Read JSON response. To read json Response you will have to add java-jason.jar to class path. Send HTTP Get Request with Parameters. For testing I have signed UP with http://ipinfodb.com/ which gives the location of IP address for a get request with the …

Continue reading