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

Get IP address Location of Client/User JAVA web project

This project shows how to take IP address of user in your Web Project. And you can use the IP address to predict the location where they are using. Update the Key after registering in the website https://ipinfodb.com/ Get_Location_From_IP.java package Modal; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; public class Get_Location_From_IP { public Location_Use_Bean get_ip_Details(String ip) …

Continue reading

JSF MySQL CRUD Create Read Update Delete Project-JSF Tutorial Part 10

This tutorial shows a simple Create Read Update Delete project in Java Server Faces JSF. Mysql is used as database here and the IDE used is NetBeans Project structure in NetBeans Mysql Database Data DB_connection.java package com.chillyfacts.com; import java.sql.Connection; import java.sql.DriverManager; public class DB_connection { public static void main(String[] args) throws Exception{ DB_connection obj_DB_connection=new DB_connection(); …

Continue reading

java.lang.ClassNotFoundException: com.mysql.jdbc:Driver [Solved]

The Exception in Java Project is shown below. java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at Simple.MyProg.main(MyProg.java:15) Solution, Download the Mysql Jar from below link. https://chillyfacts.com/mysql-connector-jar-download/ Add the jar to Classpath. Check the below link to add the Jar in …

Continue reading