Java error: Trust anchor for certification path not found.

Hello,

While sending network requests on android device i have seen strange error:
 

[spoiler]04-20 14:05:10.737: E/Corona(12183): ERROR: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
04-20 14:05:10.737: W/System.err(12183): javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
04-20 14:05:10.737: W/System.err(12183): at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:322)
04-20 14:05:10.738: W/System.err(12183): at com.android.okhttp.Connection.upgradeToTls(Connection.java:201)
04-20 14:05:10.738: W/System.err(12183): at com.android.okhttp.Connection.connect(Connection.java:155)
04-20 14:05:10.738: W/System.err(12183): at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:276)
04-20 14:05:10.738: W/System.err(12183): at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
04-20 14:05:10.738: W/System.err(12183): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:382)
04-20 14:05:10.738: W/System.err(12183): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332)
04-20 14:05:10.738: W/System.err(12183): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500)
04-20 14:05:10.738: W/System.err(12183): at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
04-20 14:05:10.738: W/System.err(12183): at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
04-20 14:05:10.738: W/System.err(12183): at network.NetworkRequest$AsyncNetworkRequestRunnable.run(NetworkRequest.java:1421)
04-20 14:05:10.738: W/System.err(12183): at java.lang.Thread.run(Thread.java:818)
04-20 14:05:10.738: W/System.err(12183): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
04-20 14:05:10.738: W/System.err(12183): at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:323)
04-20 14:05:10.738: W/System.err(12183): at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:224)
04-20 14:05:10.738: W/System.err(12183): at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:114)
04-20 14:05:10.738: W/System.err(12183): at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:550)
04-20 14:05:10.738: W/System.err(12183): at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
04-20 14:05:10.738: W/System.err(12183): at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:318)
04-20 14:05:10.738: W/System.err(12183): … 11 more
04-20 14:05:10.738: W/System.err(12183): Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
04-20 14:05:10.739: W/System.err(12183): … 17 more
04-20 14:05:10.742: W/ALooperRoster(314): failed to post message. Target handler 0 still registered, but object gone.
[/spoiler]

This bug only occurs on android device, but on simulator or when i paste this link into Fiddler4 (nice app to debugging network requests), everything goes smoothly.

Any ideas how to fix this error?

 
 

According to the internets, this is usually a server configuration issue which you can diagnose by going to:

    https://www.digicert.com/help/

and entering your server’s domain name.

If that’s not the issue, post the Lua code that is generating the error you see in your log.

Hi Perry! 

I wish i could post here that code, but i cant. Url which is mentioned is responsible for counting some data, and i just can’t share it on public forum. I can only send by private message. Here i can show only mock-up of my code, yes its as simple as that:

network.request(myUrl, "GET", function(e) print(e) end)

That server has certificate installed correctly, according to your page :slight_smile:

Is there any way to remove that certificate authentication from method network.request() on android? 

BTW on iOs working fine, on every platform is working well apart from android. 

According to the internets, this is usually a server configuration issue which you can diagnose by going to:

    https://www.digicert.com/help/

and entering your server’s domain name.

If that’s not the issue, post the Lua code that is generating the error you see in your log.

Hi Perry! 

I wish i could post here that code, but i cant. Url which is mentioned is responsible for counting some data, and i just can’t share it on public forum. I can only send by private message. Here i can show only mock-up of my code, yes its as simple as that:

network.request(myUrl, "GET", function(e) print(e) end)

That server has certificate installed correctly, according to your page :slight_smile:

Is there any way to remove that certificate authentication from method network.request() on android? 

BTW on iOs working fine, on every platform is working well apart from android.