I've made a Maven webapplication with a contactform with Google reCaptcha v3 which is running on Glassfish 5 on a Centos server. The contactform page makes a request to https://www.google.com/recaptcha/api/siteverify and sends a token and a site key. You'll get a json object answering the question if the request is coming from a bot or a human.
When Java is sending that request I got a connection error:
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targe
Java or the Glassfish server is not trusting the website because it has no valid certificate in it's keystore as explained here.
Importing the certiface with keytool (/opt/jdk1.8.0_181/jre/bin/keytool) in /opt/jdk1.8.0_181/jre/lib/security/cacerts (the keystore where the certificates are stored) is not working.