Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 462
Niranj Patel Avatar asked Feb 25 '23 14:02

Niranj Patel


1 Answers

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.

like image 132
Andrew White Avatar answered Mar 04 '23 18:03

Andrew White