1.Exception Message:Received fatal alert: handshake_failure
2.When Get PDF URL :https://allwell.mhsindiana.com/content/dam/centene/mhsindiana/Advantage/PDFs/MA-IN-20-H3499-001-EOC.pdf
3.原code:
_log.log("evidenceOfCoverageDoc PDF URL=" + pdfUrl); URLConnection conn = url.openConnection(); conn.connect(); buf.append("<div>PDF Length:" + conn.getContentLength() + "</div>");
4.分析:
根据exception 提示:Received fatal alert: handshake_failure
https://www.ssllabs.com/ 分析原因,点击Test your server ,输入Hostname 例如:allwell.mhsindiana.com
5.分析结果:https://www.ssllabs.com/ssltest/analyze.html?d=allwell.mhsindiana.com
如下图 : 关键分析看红框信息:This site works only in browser with SNI support, 所以搜索支持SNI 的JDK 版本,进行相应的升级。
6.解决方案:
找到支持SNI的JDK 版本, 升级JDK :由原来的 jdk1.8.0_77 升级到 jdk1.8.0_221
修改Tomcat 如下红色字体部分:apache-tomcat-7.0.76/bin/catalina.sh 文件
cygwin=false darwin=false os400=false hpux=false case "`uname`" in CYGWIN*) cygwin=true;; Darwin*) darwin=true;; OS400*) os400=true;; HP-UX*) hpux=true;; esac#export JAVA_HOME="/data/jdk1.8.0_74"; export JAVA_HOME="/data/jdk1.8.0_221"
# resolve links - $0 may be a softlink PRG="$0"
while [ -h "$PRG" ]; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG=`dirname "$PRG"`/"$link" fi done