this must be a very silly issue but I'm trying to read very basic information from my gitlab repository (my repo is private so I can't show you the exact URL). I execute the following code: (I published an example of the file in a public repo (https://github.com/ProgramDisciple/cube) just for this example, but in my case it must be PRIVATE and the real URL is something like (https://gitlab.com/ProgramDisciple/gitcube) but I can't post it here, sorry )
GitlabAPI gitLabApi=GitlabAPI.connect("https://gitlab.com/ProgramDisciple/cube", "API-Token");
String host=gitLabApi.getHost();//
gitLabApi.getProject("cube", "prop"); //--> here comes my error
The problem is that when I try to contact with GITLAB I get always the same error again and again:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I followed this links: Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
http://rubenjgarcia.es/sslhandshakeexception-install-ssl-keystore/
Connect to gitlab using Java's Gitlab API
But they don't solve my issue. There must be something very easy that I'm forgetting.
I've also imported the certificate of gitlab, but I still get the same problem:
./keytool -import -alias "xrepocert" -keystore "C:/Program Files/Java/jre1.8.0_181/lib/security/cacerts" -file "C:/gitlabcerts/cert/gitlab.cer"
-------------- SOLUTION --------------------------
My walkaround was using a config-server to read these properties, I followed this link (https://dzone.com/articles/using-spring-config-server) in order to get my properties read each time I start my service.