[英]javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated in Tomcat with Apache HttpClient
When trying to use Apache HttpClient 4.x on OpenJDK 1.7.0 on Ubuntu inside Tomcat, I get an 尝试在Tomcat内的Ubuntu上的OpenJDK 1.7.0上使用Apache HttpClient 4.x时,出现
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
exception. 例外。 When using the same JDK with an basic HTTPS connection like
当将相同的JDK与基本的HTTPS连接一起使用时
url = new URL(https_url);
HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
it works and I get an connection and can read the content. 它可以正常工作,并且我可以建立连接并可以读取内容。
I have followed dozens of answers on stackoverflow, googled for some days and all suggest to import the cert into the keystore. 我已经跟踪了数十个关于stackoverflow的答案,搜索了几天,都建议将证书导入到密钥库中。 I've done this, the problem persists.
我这样做了,问题仍然存在。 And it sounds strange to be my problem, as the basic connection with HttpsURLConnection works, but with HttpClient 4.x it doesn't.
听起来很奇怪,这是我的问题,因为与HttpsURLConnection的基本连接有效,但与HttpClient 4.x的连接却无效。
I found the solution last night. 我昨晚找到了解决方案。 The problem seems to be that there were 2 different bouncy castles provider JARs in the classpath.
问题似乎是在类路径中有2个不同的充气城堡提供程序JAR。 Both drawn in by two different dependencies - one for JDK 1.4.
两者都有两个不同的依赖关系-一个用于JDK 1.4。 After removing the 1.4 JDK bouncy castle jar the application worked.
删除1.4 JDK充气城堡后,该应用程序开始运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.