javax.net.ssl.SSLPeerUnverifiedException

HttpClient 请求一个URL 链接 报错如下:
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticatedpeer not authenticated 需要证书验证 但是我都已经加了不验证证书还是报错。请大侠指导。希望有代码给我,我好测试下是否可用。

0

2个回答

没人回答么?自己顶一下。

0

楼主你好,证书不对,或者过期了,这是问题分析和解决方案。
http://www.cnblogs.com/shipengzhi/archive/2012/08/22/2650953.html
望采纳。

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
bcprov-ext-jdk15on-1.52.jar,bcprov-jdk15on-1.52.jar
解决javax.net.ssl.SSLPeerUnverifiedException: 问题的包
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
用HttpClient报错,使用以下方法后还是报错,不知道怎么解决?rnprivate static DefaultHttpClient getSecuredHttpClient(HttpClient httpClient) rn final X509Certificate[] _AcceptedIssuers = new X509Certificate[] ;rn try rn SSLContext ctx = SSLContext.getInstance("TLS");rn X509TrustManager tm = new X509TrustManager() rn public X509Certificate[] getAcceptedIssuers() rn return _AcceptedIssuers;rn rnrn public void checkServerTrusted(X509Certificate[] chain,rn String authType) throws CertificateException rn rnrn public void checkClientTrusted(X509Certificate[] chain,rn String authType) throws CertificateException rn rn ;rn ctx.init(null, new TrustManager[] tm , new SecureRandom());rn SSLSocketFactory ssf = new SSLSocketFactory(ctx,rn SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);rn ClientConnectionManager ccm = httpClient.getConnectionManager();rn SchemeRegistry sr = ccm.getSchemeRegistry();rn sr.register(new Scheme("https", 443, ssf));rn return new DefaultHttpClient(ccm, httpClient.getParams());rn catch (Exception e) rn System.out.println("=====:=====");rn e.printStackTrace();rn rn return null;rn rnrnrn以下是报错信息:rnjavax.net.ssl.SSLPeerUnverifiedException: peer not authenticatedrn at sun.security.ssl.SSLSessionImpl.getPeerCertificates(Unknown Source)rn at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128)rn at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:390)rn at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:488)rn at org.apache.http.conn.scheme.SchemeSocketFactoryAdaptor.connectSocket(SchemeSocketFactoryAdaptor.java:62)rn at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)rn at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)rn at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)rn at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561)rn at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)rn at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)rn at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)rn at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)rn at com.yinglun.ecwmp.util.HttpXmlPost.sendXMLDataByPPost(HttpXmlPost.java:138)rn at com.yinglun.ecwmp.controller.AgentController.searchWopayNew(AgentController.java:841)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)rn at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)rn at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)rn at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at javacommon.filter.LoggerMDCFilter.doFilterInternal(LoggerMDCFilter.java:45)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at cn.org.rapid_framework.web.scope.FlashFilter.doFilterInternal(FlashFilter.java:28)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)rn at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)rn at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)rn at com.yinglun.ecwmp.security.MyFilterSecurityInterceptor.invoke(MyFilterSecurityInterceptor.java:57)rn at com.yinglun.ecwmp.security.MyFilterSecurityInterceptor.doFilter(MyFilterSecurityInterceptor.java:43)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)rn at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)rn at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)rn at
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated异常
[size=11px][b]如题,rn本人应用了httpclient,模拟登陆的时候遇到这个异常rnrn查了一下 貌似和 密钥证书有关rnrn希望高手指点下。以及遇到同样问题的人交流下[/b]rn[color=#FF0000]rn不求完全解决,只求经验交流[/color][/size]
SOAPUI破解密钥
破解工具破解工具
建kafka gradle工程解决证书认证问题
Down了份kafka confluent特供版本,对应版本号是3.0.0。创建gradle工程,提示认证不过,提示”Cause: peer not authenticated “之类的。 n1. 用浏览器访问对应的网站(都访问不通就不要继续了); n2. 导出证书,各浏览器差别不大;n3. 将证书导入jre
用httpclient包访问网站,老报出javax.net.ssl.SSLPeerUnverifiedException: peer not authentic
自己在用httpclient包,模拟浏览器登录网站时,老报出javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated,即网站证书出现了问题,想问一下大家这个怎么解决?
忽略ssl使用httpclient访问阿里支付宝
Alipay.javanimport java.io.IOException;nimport java.io.UnsupportedEncodingException;nimport java.util.ArrayList;nimport java.util.HashMap;nimport java.util.Hashtable;nimport java.util.Iterator;nimpor
xUtils3.x的网络请求封装和请求https之单向SSL验证
很久没写博客了, 自己定的路已经走歪,菜鸟的进阶之路上我只是走了一步,自从发了一篇博客之后在没有来过这里,已经有一年了吧,今天再次回到这里。n言归正传,今天要写的是xUtils3.x网络请求的封装和请求https,最近xUtils做出了一次比较大的重构,原有的使用规则都有了新的变化。具体的变化可以去 https://github.com/wyouflf/xUtils3.git n,还有很多大神
Web Api 的 路由机制
ASP.NET Web API 是一种框架,用于轻松构建可以访问多种客户端(包括浏览器和移动设备)的 HTTP 服务。 ASP.NET Web API 是一种用于在 .NET Framework 上构建 RESTful 应用程序的理想平台。所以我们要想学习web api 就要去了解它的路由机制。MVC和web api的路由机制的主要区别是web api 使用的是http 方法而不是url 的路径。本
文章热词 机器学习教程 Objective-C培训 交互设计视频教程 颜色模型 设计制作学习
相关热词 mysql关联查询两次本表 native底部 react extjs glyph 图标 怎么学习互联网大数据 村干部学习大数据心得