我的工作,是为了集成在其他应用程序的库。我有一个HTTPS服务器进行通信,而我使用Apache Commons的HttpClient 3.1。我有我自己的密钥库和需要注册的协议经由:Protocol.registerProtocol。我想知道是否有注册此客户端的我的具体实例,而不是静态的方式 - 这种方式我不弄乱任何其他情况下,没有人弄乱我

我看到的东西在那里我能得到客户HostConfiguration和呼叫的 setHost 时,与协议,但它不会出现工作正常。我注册它像:

HostConfiguration config = client.getHostConfiguration();
config.setHost(remoteUrl.getHost(), remoteUrl.getPort(), new Protocol("https", new MyProtocolSocketFactory(), 443));

但试图建立连接时,SSL握手失败,而它使用Protocol.registerProtocol使用相同的参数时工作。故障是标准:

Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

有帮助吗?

解决方案

升级到HttpComponents 4和单独假客户3.x的。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top