Android Question Trust anchor for certification path not found.

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi Erel,

Since i have updated to B4A 11.0 jobs are failing.
shows Trust anchor for certification path not found.

I searched forum and added conditional parameter HU2_ACCEPTALL in build configuration window but it throws error, For HU2_PUBLIC it doesn't give error but job still fails saying
Trust anchor for certification path not found.

Can you pls guide.

Manifest -:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)

Thanks
Juzer
 

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi Erel,
Sorry for the duplicate post.
I have added the 2 okhttp and okhttputils2 libraries back again to get the error.

1. In configuration SYMBOLS -: HU2_PUBLIC
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found., Response:

2. In configuration SYMBOLS -: HU2_ACCEPTALL
(full error msg from log)
B4X:
Logger connected to:  samsung SM-M105F
--------- beginning of crash
--------- beginning of main
*** Service (starter) Create ***
Using FileProvider? true
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
*** Service (svc_checkinternet) Create ***
** Service (svc_checkinternet) Start **
*** Service (adservice) Create ***
** Service (adservice) Start **
*** Service (checkversion) Create ***
** Service (checkversion) Start **
** Activity (frmactivities) Create, isFirst = true **
** Activity (frmactivities) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Service (httputils2service) Start **
** Service (httputils2service) Start **
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found., Response:
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found., Response:
** Activity (frmactivities) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
** Service (adservice) Destroy **
** Service (checkversion) Destroy **
** Service (svc_checkinternet) Destroy **
** Service (httputils2service) Destroy **
*** Service (starter) Create ***
Using FileProvider? true
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
*** Service (svc_checkinternet) Create ***
** Service (svc_checkinternet) Start **
*** Service (adservice) Create ***
** Service (adservice) Start **
*** Service (checkversion) Create ***
** Service (checkversion) Start **
** Activity (frmactivities) Create, isFirst = true **
** Activity (frmactivities) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Service (httputils2service) Start **
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found., Response:
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found., Response:
** Activity (frmactivities) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
** Service (adservice) Destroy **
** Service (checkversion) Destroy **
** Service (svc_checkinternet) Destroy **
** Service (httputils2service) Destroy **
*** Service (starter) Create ***
Using FileProvider? true
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
*** Service (svc_checkinternet) Create ***
** Service (svc_checkinternet) Start **
*** Service (adservice) Create ***
** Service (adservice) Start **
*** Service (checkversion) Create ***
** Service (checkversion) Start **
** Activity (frmactivities) Create, isFirst = true **
** Activity (frmactivities) Resume **
*** Service (httputils2service) Create ***
(Http client initialized with accept all option.)
** Service (httputils2service) Start **
** Service (httputils2service) Start **
ResponseError. Reason: Internal Server Error, Response: <!DOCTYPE html>

<html>

    <head>

        <title>Runtime Error</title>

        <meta name="viewport" content="width=device-width" />

        <style>

         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}

         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}

         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}

         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}

         .marker {font-weight: bold; color: black;text-decoration: none;}

         .version {color: gray;}

         .error {margin-bottom: 10px;}

         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:pointer; }

         @media screen and (max-width: 639px) {

          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }

         }

         @media screen and (max-width: 479px) {

          pre { width: 280px; }

         }

        </style>

    </head>



    <body bgcolor="white">



            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>



            <h2> <i>Runtime Error</i> </h2></span>



            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">



            <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

            <br><br>



            <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a &lt;customErrors&gt; tag within a &quot;web.config&quot; configuration file located in the root directory of the current web application. This &lt;customErrors&gt; tag should then have its &quot;mode&quot; attribute set to &quot;Off&quot;.<br><br>



            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code><pre>



&lt;!-- Web.Config Configuration File --&gt;



&lt;configuration&gt;

    &lt;system.web&gt;

        &lt;customErrors mode=&quot;Off&quot;/&gt;

    &lt;/system.web&gt;

&lt;/configuration&gt;</pre>                      </code>



                  </td>

               </tr>

            </table>



            <br>



            <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the &quot;defaultRedirect&quot; attribute of the application&#39;s &lt;customErrors&gt; configuration tag to point to a custom error page URL.<br><br>



            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code><pre>



&lt;!-- Web.Config Configuration File --&gt;



&lt;configuration&
Message longer than Log limit (4000). Message was truncated.
ResponseError. Reason: Internal Server Error, Response: <!DOCTYPE html>

<html>

    <head>

        <title>Runtime Error</title>

        <meta name="viewport" content="width=device-width" />

        <style>

         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}

         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}

         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}

         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}

         .marker {font-weight: bold; color: black;text-decoration: none;}

         .version {color: gray;}

         .error {margin-bottom: 10px;}

         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:pointer; }

         @media screen and (max-width: 639px) {

          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }

         }

         @media screen and (max-width: 479px) {

          pre { width: 280px; }

         }

        </style>

    </head>



    <body bgcolor="white">



            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>



            <h2> <i>Runtime Error</i> </h2></span>



            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">



            <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

            <br><br>



            <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a &lt;customErrors&gt; tag within a &quot;web.config&quot; configuration file located in the root directory of the current web application. This &lt;customErrors&gt; tag should then have its &quot;mode&quot; attribute set to &quot;Off&quot;.<br><br>



            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code><pre>



&lt;!-- Web.Config Configuration File --&gt;



&lt;configuration&gt;

    &lt;system.web&gt;

        &lt;customErrors mode=&quot;Off&quot;/&gt;

    &lt;/system.web&gt;

&lt;/configuration&gt;</pre>                      </code>



                  </td>

               </tr>

            </table>



            <br>



            <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the &quot;defaultRedirect&quot; attribute of the application&#39;s &lt;customErrors&gt; configuration tag to point to a custom error page URL.<br><br>



            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code><pre>



&lt;!-- Web.Config Configuration File --&gt;



&lt;configuration&
Message longer than Log limit (4000). Message was truncated.

In manifest
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>)
SetApplicationAttribute(android:usesCleartextTraffic, "true")

Pls reply.
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi Erel,

Just to confirm site settings i created a new project with source files of HttpUtils2Service and HttpJob added.
The job gets completed without any issue.

I removed Conditional Symbol in problem project and added the same 2 source files
I get following error
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found., Response:

The manifest entry is same in both projects.

This means site settings are not the issue.

Pls give some clue.

Thanks
Juzer
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi Erel,

Just to confirm site settings i created a new project with source files of HttpUtils2Service and HttpJob added.
The job gets completed without any issue.

I removed Conditional Symbol in problem project and added the same 2 source files
I get following error
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found., Response:

The manifest entry is same in both projects.

This means site settings are not the issue.

Pls give some clue.

Thanks
Juzer
I got the issue finally in URL http:// was missing. In B4A 11 it won't do.
Thanks for all your help.
 
Upvote 0
Top