javax.net.ssl.SSLException:不受信任的服务器证书

时间:2011-04-08 11:07:46

标签: android sockets

我尝试使用Url的XML解析器(“https://....etc”)读取XML数据。 但我面临以下错误。 这是我的日志。

  

04-08 16:34:23.017:   WARN / System.err的(8052):   javax.net.ssl.SSLException:没有   可信服务器证书

     

04-08   16:34:23.098:WARN / System.err(8052):   在   org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:371)

     

04-08 16:34:23.107:   WARN / System.err(8052):at   org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:92)

     

04-08 16:34:23.107:   WARN / System.err(8052):at   org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:381)

     

04-08 16:34:23.107:   WARN / System.err(8052):at   org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:164)

     

04-08 16:34:23.116:   WARN / System.err(8052):at   org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)

     

04-08 16:34:23.116:   WARN / System.err(8052):at   org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)

     

04-08 16:34:23.116:   WARN / System.err(8052):at   org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)

     

04-08 16:34:23.116:   WARN / System.err(8052):at   org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)

     

04-08 16:34:23.127:   WARN / System.err(8052):at   org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)

     

04-08 16:34:23.127:   WARN / System.err(8052):at   org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)

     

04-08 16:34:23.127:   WARN / System.err(8052):at   androidexperts.apps.prontonnetworks.xmlparser。(xmlparser.java:108)

     

04-08 16:34:23.196:   WARN / System.err(8052):at   androidexperts.apps.prontonnetworks.prontonnetworks $ HandlerServer.doInBackground(prontonnetworks.java:486)

     

04-08 16:34:23.232:   WARN / System.err(8052):at   androidexperts.apps.prontonnetworks.prontonnetworks $ HandlerServer.doInBackground(prontonnetworks.java:1)

     

04-08 16:34:23.257:   WARN / System.err(8052):at   android.os.AsyncTask $ 2.call(AsyncTask.java:185)

     

04-08 16:34:23.287:   WARN / System.err(8052):at   java.util.concurrent.FutureTask中$ Sync.innerRun(FutureTask.java:305)

     

04-08 16:34:23.307:   WARN / System.err(8052):at   java.util.concurrent.FutureTask.run(FutureTask.java:137)

     

04-08 16:34:23.317:   WARN / System.err(8052):at   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)

     

04-08 16:34:23.317:   WARN / System.err(8052):at   java.util.concurrent.ThreadPoolExecutor中$ Worker.run(ThreadPoolExecutor.java:561)

     

04-08 16:34:23.317:   WARN / System.err(8052):at   java.lang.Thread.run(Thread.java:1096)

     

04-08 16:34:23.317:   WARN / System.err(8052):引起:   java.security.cert.CertificateException:   java.security.cert.CertPathValidatorException:   未找到CertPath的TrustAnchor。   04-08 16:34:23.327:   WARN / System.err(8052):at   org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:168)

     

04-08 16:34:23.327:   WARN / System.err(8052):at   org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:366)

     

04-08 16:34:23.337:   WARN / System.err(8052):... 18更多

     

04-08 16:34:23.337:   WARN / System.err(8052):引起:   java.security.cert.CertPathValidatorException:   找不到CertPath的TrustAnchor。

     

04-08 16:34:23.377:   WARN / System.err(8052):at   org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:149)

     

04-08 16:34:23.377:   WARN / System.err(8052):at   java.security.cert.CertPathValidator.validate(CertPathValidator.java:202)

     

04-08 16:34:23.377:   WARN / System.err(8052):at   org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:164)

任何人都知道吗?

1 个答案:

答案 0 :(得分:8)

您正在尝试连接到HTTPS URL,并且您正在运行代码的设备不信任该站点提供的SSL证书。我建议你阅读this question on setting up trust in the Apache HTTP Client