在使用Https协议时,本地服务器运行正常调用,但是将项目部署到阿里云服务上时,报错
sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
解决方法:
将
URL url= new URL(url);
改为
URL url= new URL(null, url, new sun.net.www.protocol.https.Handler());
在使用Https协议时,本地服务器运行正常调用,但是将项目部署到阿里云服务上时,报错
sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
解决方法:
将
URL url= new URL(url);
改为
URL url= new URL(null, url, new sun.net.www.protocol.https.Handler());