Problem with connecting fortress rest over HTTPS the first time the core is built
Happens first time apache fortress core is built after changing its config to use https
Config
# name of java keystore that contains slapd's ca cert:
trust.store=/opt/fortress/directory-fortress-core/config/truststore.jks
trust.store.onclasspath=false
trust.store.password=...
enable.mgr.impl.rest=true
# This user account is added automatically during deployment of fortress-rest via -Dload.file=./src/main/resources/FortressRestServerPolicy.xml:
http.user=...
http.pw=...
http.host=fortress-a
http.port=8443
http.protocol=https
Error (first time)
2022-07-10 18:09:036 INFO RestUtils:142 - javax.net.ssl.trustStore: /opt/fortress/directory-fortress-core/config/truststore.jks
2022-07-10 18:09:036 ERROR RestUtils:389 - post uri=[https://fortress-a:8443/fortress-rest-2.0.8-SNAPSHOT/], function=[cfgRead], caught IOException=PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilder
Exception: unable to find valid certification path to requested target
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
...
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
...
Caused by: org.apache.directory.fortress.core.RestException: post uri=[https://fortress-a:8443/fortress-rest-2.0.8-SNAPSHOT/], function=[cfgRead], caught IOException=PKIX path building failed: sun.security.provider.certpath.
SunCertPathBuilderException: unable to find valid certification path to requested target
at org.apache.directory.fortress.core.rest.RestUtils.post (RestUtils.java:390)
Build the fortress core a second time, rerun the test and it works.