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/
0 Comments
Comments
Leave a Comment