自签名证书 - 无法使用 ANT Build 进行连接 [英] Self-signed Certificate - Unable to connect using ANT Build

查看:34
本文介绍了自签名证书 - 无法使用 ANT Build 进行连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接到特定网页中的所有链接并获取响应以查看链接是否已损坏.
有些链接是经过自我认证的 SSL.所以,我遵循了将证书添加到信任存储的过程.之后它工作正常,当我在 Eclipse 中测试它时(它返回 OK/200).
但是,当我在命令行中使用 ANT 构建和运行项目时,会出现相同的异常.奇怪的是,当我通过 Eclipse 使用相同的 xml 构建时,它不会发生;它只是有效!

I'm trying to connect to all the links in a particular webpage and get the response to see if the link is broken.
Some of the links are SSL that too self-certified. So, I've followed the procedure of adding the certificate to trust store. After that it worked fine, when I tested the same in Eclipse(it returned OK/200).
But, when I build and run the project using ANT in command line, the same exception appears. And it is weird that it doesn't happen when I build using the same xml through Eclipse; it simply works!

sun.security.validator.ValidatorException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到到请求目标的有效认证路径

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

推荐答案

根据我之前的评论,Java 在 JDK 旁边安装了 JRE,而 JDK 也安装了 JRE.因此,如果您不确定使用哪个,您可以尝试将证书添加到 jre\lib\security\cacerts 和 jdk1.x.0_xx\jre\lib\security\cacerts.

As per my previous comments Java installs a JRE alongside the JDK which in turn also has a JRE installed. Thus if you are not sure which one is used you can try to add the certificate into jre\lib\security\cacerts and jdk1.x.0_xx\jre\lib\security\cacerts.

这篇关于自签名证书 - 无法使用 ANT Build 进行连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆