javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake

1.问题如何出现的?

使用httpclient访问https开头的url。

这个问题比较奇怪,并不是所有的https开头的都不能访问,比如https://www.baidu.com/ 就可以访问,不知道是不是这个网站的证书有问题。在有的服务器上,curl 这个网站会出现这个:

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

2. https://blog.csdn.net/kevin_mails/article/details/82143490 (感谢这位kevin_mails网友给我提供了思路)看到这篇文章之后,引发了我的测试。

我最开始用的是jdk1.8_181, 按照上篇文章所说应该什么也不用修改就是正常的,但是就是出了问题。然后我用jdk1.8_25、jdk1.8_144、jdk1.8_151、jdk1.8_162都是正常的(无需任何修改)。其中162和181的jdk1.8.0_162\jre\lib\security的java.security是最接近的,关于crypto.policy=unlimited这部分完全一样。

下面是两个java.security对比:有四个地方不一致

 

3. 问题解决:

实际上就是用162的java.security替换掉181的java.security就可以了,我是这样做的。

 

4.总结: 在网上可能搜到了一样的问题,但是解决办法却不一定适用于自己,希望这篇文章对大家有所帮助。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值