使用HttpClient携带pfx证书通过Https协议发送SOUP报文调用WebService接口时报如下错误:

Exception in thread "main" javax.net.ssl.SSLPeerUnverifiedException: Certificate for <IP地址> doesn't match any of the subject alternative names: [域名]
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname(SSLConnectionSocketFactory.java:467)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:397)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:355)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
at vodafone.KeystoreUtil.main(KeystoreUtil.java:76)

问题分析:

颁发的证书是给制定域名的而非IP地址,因为服务器没有加入Public DNS,所以域名无法访问,我在调用接口时直接使用了IP地址,而不是域名。

问题解决:

在hosts配置文件中添加IP地址和域名的映射记录,在调用接口时使用域名进行调用,发现问题解决。

使用HttpClient携带证书报错_Certificate for <IP> doesn't match any of the subject alternative names:[域名]的更多相关文章

  1. 用HttpClient发送HTTPS请求报SSLException: Certificate for <域名> doesn't match any of the subject alternative names问题的解决

    最近用server酱-PushBear做消息自动推送,用apache HttpClient做https的get请求,但是代码上到服务器端就报javax.net.ssl.SSLException: Ce ...

  2. 自签证书 doesn't match any of the subject alternative names

    出现这个的原因是https中的域名或者IP,与证书中登记的不一致. 如果是自签证书的话,可以根据具体需要重新生成证书. 还有一种解决方案是在java中跳过这个检查. 绕过检查分两类,一个是绕过证书在C ...

  3. 转载-解决使用httpClient 4.3.x登陆 https时的证书报错问题

    今天在使用httpClient4.3.6模拟登陆https网站的时候出现了证书报错的问题,这是在开源中国社区里找到的可行的答案(原文链接:http://www.oschina.net/question ...

  4. 安装Oracle 11gR2,报错:[INS-06101] IP address of localhost could not be determined

    安装Oracle 11gR2,报错:[INS-06101] IP address of localhost could not be determined 出现这种错误是因为主机名和/etc/host ...

  5. 解决pgpool启动报错 ifup[/sbin/ip] doesn't have setuid bit

    1.问题出现: 在centos7启动pgpool服务器报错ifup[/sbin/ip] doesn't have setuid bit 2018-11-25 01:14:14: pid 38122: ...

  6. 【spring data jpa】repository中使用@Query注解使用hql查询,使用@Param引用参数,报错:For queries with named parameters you need to use provide names for method parameters. Use @Param for query method parameters, or when on

    在spring boot中, repository中使用@Query注解使用hql查询,使用@Param引用参数 如题报错: For queries with named parameters you ...

  7. selenium的报错信息:selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class names not permitted

    报错信息:selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class ...

  8. docker运行报错docker0: iptables: No chain/target/match by that name.

    转自:https://blog.csdn.net/wohaqiyi/article/details/84450562 docker运行报错docker0: iptables: No chain/tar ...

  9. SpringBoot 连接kafka ssl 报 CertificateException: No subject alternative names present 异常解决

    当使用较新版本SpringBoot时,对应的 kafka-client 版本也比较新,如果使用了 2.x 以上的 kafka-client ,并且配置了 kafka ssl 连接方式时,可能会报如下异 ...

随机推荐

  1. [LeetCode] Contains Duplicate(II,III)

    Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your funct ...

  2. CDN具体解释(篇二)

    还有还有一个问题就是全部的内容都放在同一个地方.假设我们的server在芝加哥,那么美国中西部的人们訪问server的响应时间和用户体验就比香港.德国.南非以及佛罗里达州的用户好.由于那些用户离ser ...

  3. POST &amp; GET &amp; Ajax 全解

    GET&POST&Ajax 全解 一.POST和GET的差别 GET:GET方法提交数据不安全,数据置于请求行.客户段地址栏可见:GET方法提交的数据限制大小在255个字符之内.參数直 ...

  4. 故障案例:磁盘空间不足可能引起的mysql问题

    此前在工作中.由于客户的磁盘空间报警没怎么注意.空间不足引起了下面可能发生的mysql问题 1    mysql进程起不来 2    mysql无法正常关闭,必须kill -9 3    mysql能 ...

  5. mount: wrong fs type

    # mount -t nfs -o nolock 192.168.1.84:/home/jason/filesys /mnt/nfsmount: wrong fs type, bad option, ...

  6. onDestroy强制退出后,process crash的处理

    from http://bbs.9ria.com/thread-248722-1-1.html     一般情况,我们在执行测试的过程中都会调用tearDwon方法,以Robotium为例,我们在te ...

  7. 解决IOS滑动页面fixed浮动问题

    <div style="position: fixed"></div> <div style="height: 100%; overflow ...

  8. js控制页面显示

    两个菜单切换显示页面内容: js控制代码, /** JS初始化 **/ $(document).ready(function() { $('#email_btn').click(function(){ ...

  9. [Usaco2015 OPEN] Palindromic Paths

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=4098 [算法] 显然 , 回文路径中第i个字母的位置(x , y)必然满足 : x ...

  10. 《Microsoft COCO Captions Data Collection and Evaluation Server》论文笔记

    出处:CVPR2015 Motivation 本文描述了MSCoco标题数据集及评估服务器(Microsoft COCO Caption dataset and evaluation server), ...