Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
227 views
in Technique[技术] by (71.8m points)

android - javax.net.ssl.SSLException: Not trusted server certificate

I m trying read XML data using XML parser from Url("https://....etc"). But I'm facing below error. This is my log.

04-08 16:34:23.017: WARN/System.err(8052): javax.net.ssl.SSLException: Not trusted server certificate

04-08 16:34:23.098: WARN/System.err(8052): at 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): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found. 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 more

04-08 16:34:23.337: WARN/System.err(8052): Caused by: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.

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)

any one know about it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You are attempting to connect to an HTTPS URL via and the SSL certificate provided by the site is not trusted by the devise you are running the code on. I suggest you read this question on setting up trust in the Apache HTTP Client.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...