title: Android - Retrofit2 - java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
body: <p>I want to get data from the server (<a href="https://data.egov.kz/api/v2/zheke_zhane_zandy_tulgalardy_k1/v6?pretty" rel="nofollow noreferrer">https://data.egov.kz/api/v2/zheke_zhane_zandy_tulgalardy_k1/v6?pretty</a>) as an array of json objects. But I get this Log:
      <strong>java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.</strong>
   I am using Retrofit2 and here my code:</p>
  
  <h3>MainActivity.java</h3>
  
  <pre><code>public class MainActivity extends AppCompatActivity
      implements GetAdmissionSchedule.GetAdmissionScheduleInterface {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          GetAdmissionSchedule getAdmissionSchedule = new GetAdmissionSchedule(this);
          getAdmissionSchedule.getAdmissionScheduleList();
      }
  
      @Override
      public void getAdmissionSchedule(List&lt;AdmissionSchedule&gt; admissionScheduleList) {
          // here i get my data
      }
  
  }
  </code></pre>
  
  <h3>GetAdmissionSchedule.java</h3>
  
  <pre><code>public class GetAdmissionSchedule {
  
      private GetAdmissionScheduleInterface getAdmissionScheduleInterface;
  
      public GetAdmissionSchedule(GetAdmissionScheduleInterface getAdmissionScheduleInterface) {
          this.getAdmissionScheduleInterface = getAdmissionScheduleInterface;
      }
  
      public interface GetAdmissionScheduleInterface {
          void getAdmissionSchedule(List&lt;AdmissionSchedule&gt; admissionScheduleList);
      }
  
      public void getAdmissionScheduleList() {
          DataEgovApi service = DataEgovBaseURL.getRetrofit();
          Call&lt;List&lt;AdmissionSchedule&gt;&gt; call = service.getAdmissionScheduleList();
          call.enqueue(new Callback&lt;List&lt;AdmissionSchedule&gt;&gt;() {
              @Override
              public void onResponse(Call&lt;List&lt;AdmissionSchedule&gt;&gt; call, Response&lt;List&lt;AdmissionSchedule&gt;&gt; response) {
                  Log.d("MyLogs", "MVD: getAdmissionScheduleList " + response.code());
                  getAdmissionScheduleInterface.getAdmissionSchedule(response.body());
              }
  
              @Override
              public void onFailure(Call&lt;List&lt;AdmissionSchedule&gt;&gt; call, Throwable t) {
                  Log.d("MyLogs", "MVD: getAdmissionScheduleList " + t.getLocalizedMessage());
                  getAdmissionScheduleInterface.getAdmissionSchedule(null);
              }
          });
      }
  
  }
  </code></pre>
  
  <h3>DataEgovBaseURL.java</h3>
  
  <pre><code>public class DataEgovBaseURL {
  
      private static final String BASE_URL = "https://data.egov.kz/";
      private static Retrofit retrofit = null;
  
      public static DataEgovApi  getRetrofit() {
          if (retrofit == null) {
              retrofit = new Retrofit.Builder()
                      .baseUrl(BASE_URL)
                      .addConverterFactory(GsonConverterFactory.create())
                      .build();
  
          }
          return retrofit.create(DataEgovApi.class);
      }
  
  }
  </code></pre>
  
  <h3>DataEgovApi.java</h3>
  
  <pre><code>public interface DataEgovApi {
  
      @GET("api/v2/zheke_zhane_zandy_tulgalardy_k1/v6?pretty")
      Call&lt;List&lt;AdmissionSchedule&gt;&gt; getAdmissionScheduleList();
  
  }
  </code></pre>
  
  <h3>AdmissionSchedule.java (My POJO class)</h3>
  
  <pre><code>public class AdmissionSchedule {
  
      @SerializedName("id")
      @Expose
      private String id;
      @SerializedName("vremia")
      @Expose
      private String vremia;
      @SerializedName("adres_ru")
      @Expose
      private String adresRu;
      @SerializedName("doljnost_ru")
      @Expose
      private String doljnostRu;
      @SerializedName("name_ru")
      @Expose
      private String nameRu;
      @SerializedName("data")
      @Expose
      private String data;
      @SerializedName("adres_kz")
      @Expose
      private String adresKz;
      @SerializedName("doljnost_kz")
      @Expose
      private String doljnostKz;
      @SerializedName("name_kz")
      @Expose
      private String nameKz;
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public String getVremia() {
          return vremia;
      }
  
      public void setVremia(String vremia) {
          this.vremia = vremia;
      }
  
      public String getAdresRu() {
          return adresRu;
      }
  
      public void setAdresRu(String adresRu) {
          this.adresRu = adresRu;
      }
  
      public String getDoljnostRu() {
          return doljnostRu;
      }
  
      public void setDoljnostRu(String doljnostRu) {
          this.doljnostRu = doljnostRu;
      }
  
      public String getNameRu() {
          return nameRu;
      }
  
      public void setNameRu(String nameRu) {
          this.nameRu = nameRu;
      }
  
      public String getData() {
          return data;
      }
  
      public void setData(String data) {
          this.data = data;
      }
  
      public String getAdresKz() {
          return adresKz;
      }
  
      public void setAdresKz(String adresKz) {
          this.adresKz = adresKz;
      }
  
      public String getDoljnostKz() {
          return doljnostKz;
      }
  
      public void setDoljnostKz(String doljnostKz) {
          this.doljnostKz = doljnostKz;
      }
  
      public String getNameKz() {
          return nameKz;
      }
  
      public void setNameKz(String nameKz) {
          this.nameKz = nameKz;
      }
  
  }
  </code></pre>