# java.security.cert.CertPathValidatorException: Trust anchor for certification path not found

**URL:** <https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298>\
**Category:** Ayuda (en Español)\
**Created:** [November 22, 2022, 7:05pm UTC](https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298 "2022-11-22T19:05:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wrbutros](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/wrbutros/32/65829_2.png) [@wrbutros](https://community.letsencrypt.org/u/wrbutros)\
**Post date:** [November 22, 2022, 7:05pm UTC](https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298/1 "2022-11-22T19:05:08Z")

</div>

Puedo leer las respuestas en Inglés (sí o no): **SI**

Mi dominio es: **transbaluso.cl**

El sistema operativo en el que se ejecuta mi servidor web es (incluya la versión):  
**Archlinux con Nginx 1.22.1**

Puedo iniciar una sesión en una shell root en mi servidor (sí, no o no lo sé): **SI**

Estoy usando un panel de control para administrar mi sitio (no o proporcione el nombre y la versión del panel de control): **NO**

La versión de mi cliente es (por ejemplo, si usa certbot, muestre la salida de `certbot --version` o `certbot-auto --version`): **1.32.0**

Sucede que el certificado funciona perfectamente con clientes web y con una app que hice con react-native en iOS, pero no funciona con android, en android me da este error:  
`java.security.cert.CertPathValidatorException: Trust anchor for certification path not found`

Todos los celulares con android no logran conectarse a mi API debido al certificado.  
He intentado todas los soluciones posibles desde el lado del software, pero sigue sin funcionar.

Quería consultar aquí por si saben algo sobre este error.

Saludos!

---

<div class="post-metadata">

**Author:** ![Bruce5051](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/bruce5051/32/76576_2.png) [@Bruce5051](https://community.letsencrypt.org/u/Bruce5051)\
**Post date:** [November 22, 2022, 7:19pm UTC](https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298/2 "2022-11-22T19:19:36Z")

</div>

Hello @wrbutros, welcome to the Let's Encrypt community. 🙂

**What version of Java are you having an issue with?**

Using [SSL Server Test (Powered by Qualys SSL Labs)](https://www.ssllabs.com/ssltest/) I see results [SSL Server Test: transbaluso.cl (Powered by Qualys SSL Labs)](https://www.ssllabs.com/ssltest/analyze.html?d=transbaluso.cl)

 ![image](https://global.discourse-cdn.com/letsencrypt/original/3X/4/b/4bbfbf071e07cd617d6dd7ced614ff75d826f3e8.png)

Supplemental information:  
Here is a list of issued certificates [crt.sh | transbaluso.cl](https://crt.sh/?q=transbaluso.cl), the latest being **2022-11-22**.  
However this is the certificate being served.

 ![image](https://global.discourse-cdn.com/letsencrypt/original/3X/d/b/db86f7dcd791341be939df030c8443fe12e4cdb7.png)

---

<div class="post-metadata">

**Author:** ![schoen](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/schoen/32/79_2.png) [@schoen](https://community.letsencrypt.org/u/schoen)\
**Post date:** [November 22, 2022, 7:42pm UTC](https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298/3 "2022-11-22T19:42:12Z")

</div>

Hola @wrbutros,

Creo que lo mas probable sea

> [@Long (default) and Short (alternate) Certificate Chains Explained](https://community.letsencrypt.org/t/long-default-and-short-alternate-certificate-chains-explained/162526):
>
> I…

En este caso, usted está usando la "long chain" (con el certificado raíz caducado).

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [November 22, 2022, 7:43pm UTC](https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298/4 "2022-11-22T19:43:59Z")

</div>

> [@schoen](#):
>
> En este caso, usted está usando la "long chain" (con el certificado raíz caducado).

Yes, but OP mentions they're using Android. And the long chain is _for_ (older) Android phones. So one would assume there wouldn't be an issue with the long chain, right?

The following thread had the same issue with an older Android (5.1), but with a stock ROM everything was fine again: [Trust anchor for certification path not found (Android 5.1) - #6 by Martin38](https://community.letsencrypt.org/t/trust-anchor-for-certification-path-not-found-android-5-1/172032/6)

---

<div class="post-metadata">

**Author:** ![schoen](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/schoen/32/79_2.png) [@schoen](https://community.letsencrypt.org/u/schoen)\
**Post date:** [November 22, 2022, 7:49pm UTC](https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298/5 "2022-11-22T19:49:38Z")

</div>

> [@Osiris](#):
>
> Yes, but OP mentions they're using Android. And the long chain is _for_ (older) Android phones. So one would assume there wouldn't be an issue with the long chain, right?

Good point!

---

<div class="post-metadata">

**Author:** ![MikeMcQ](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/mikemcq/32/52772_2.png) [@MikeMcQ](https://community.letsencrypt.org/u/MikeMcQ)\
**Post date:** [November 22, 2022, 8:04pm UTC](https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298/6 "2022-11-22T20:04:00Z")

</div>

> [@wrbutros](#):
>
> java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
> 
> Mi dominio es: transbaluso.cl

Are you sure that error is for a connection to that domain name?

And, is it multiple Android devices that fail?

Because, as you say, the cert looks fine from a browser and your iOS app just not this app. Bruce also shows SSLLabs showed the cert was fine.

So, I would guess the error is for something else. Or, perhaps your CA cert store on Andorid is damaged or your comms config selected an alternate CA Store.

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [November 23, 2022, 2:51am UTC](https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298/7 "2022-11-23T02:51:08Z")

</div>

Can you use that same Android device with Java and connect to other sites that also use LE certs with the long chain?

Can you provide the port used with your app?  
[and a test query (URL) if not plain `https://your.domain/`]

---

<div class="post-metadata">

**Author:** ![wrbutros](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/wrbutros/32/65829_2.png) [@wrbutros](https://community.letsencrypt.org/u/wrbutros)\
**Post date:** [November 23, 2022, 8:03am UTC](https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298/8 "2022-11-23T08:03:39Z")

</div>

Hi everyone!  
I managed to make the application connect with my API successfully, but I'm still researching the origin of the problem.

More context:

- My mobile application is made by React Native + Expo.
- I compiled a version for iOS and another for Android.
- The problem just suddenly happened only in the Android  
(In all the android devices without have made any change in the mobile app or the server)
- iOS can connect with the API without problem
- The website can communicate with the API without problem

It seems to be a problem of the library `axios` (specifically `axiosinstance`).  
Its weird because I didn't change anything in the android app, it just suddenly stopped to work.  
(in all the android devices at the same time).

And just doing tests I realized that `axiosinstance` fails by doing the request (with the exception that I already showed you), but in an inexplicable way if the first request pointing to my API is by using `axios` it works perfectly, and after that `axiosinstance` is capable to perform any request to my API without fail.

I know it sounds weird, but now my app is working again.

By other Side, just to let you know, I also tested an android app called `API Tester v5.6` and it fails connecting to my API giving me the same exception, but it last version `API Tester 5.7` (which was released just some days ago) works without problem.

I also tried to connect to my API with `ApiClient v2.4.7` and it fails with the same exception.

Again, I don't understand what is the real problem but definitely is not the certificate.

Anyway, thank you so much for your help!  
you are the best!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [December 23, 2022, 8:03am UTC](https://community.letsencrypt.org/t/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-path-not-found/188298/9 "2022-12-23T08:03:48Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
