解决JDK异常处理No appropriate protocol问题
JDK异常处理No appropriate protocol
异常展示
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171) ~[na:1.8.0_292]
at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:98) ~[na:1.8.0_292]
at sun.security.ssl.TransportContext.kickstart(TransportContext.java:220) ~[na:1.8.0_292]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:428) ~[na:1.8.0_292]
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:275) ~[httpclient-4.3.2.jar:4.3.2]
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:254) ~[httpclient-4.3.2.jar:4.3.2]
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:118) ~[httpclient-4.3.2.jar:4.3.2]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:314) ~[httpclient-4.3.2.jar:4.3.2]
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363) ~[httpclient-4.3.2.jar:4.3.2]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219) ~[httpclient-4.3.2.jar:4.3.2]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) ~[httpclient-4.3.2.jar:4.3.2]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85) ~[httpclient-4.3.2.jar:4.3.2]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) ~[httpclient-4.3.2.jar:4.3.2]
分析
倘若是2021年5月后安装的jdk,最新版jdk不支持ssl
解决办法
找到jdk 1.8安装目录,找到C:\Program Files\Java\jre里面的lib\security 下面有个java.security。
找到对应的SSLv3,删除掉,重启项目就好了。(删掉SSLv3就是允许SSL调用)
红框中的全部删除掉即可通过SSL调用
处理JDK相关的linux命令
查询系统自带的jdk包括自己安装的openjdk
rpm -qa | grep java
删除自带的jdk或者自己安装的openjdk
rpm -e --nodeps java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
命令介绍:
rpm
:管理套件-e
:删除指定的套件--nodeps
:不验证套件档的相互关联性
JDK相关版本下载
安装
1.将安装包上传到服务器例如 /opt/java 文件夹下
2.解压
3.配置环境文件
export JAVA_HOME=/opt/java/jdk1.8.0_281 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:{JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
4.使环境文件生效
source /etc/profile
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
spring MVC + bootstrap实现文件上传示例(带进度条)
本篇文章主要介绍了spring MVC + bootstrap实现文件上传示例(带进度条),非常具有使用价值,有需要的朋友可以了解一下。2017-03-03
最新评论