Fail to create Bitbucket Cloud repository in Bamboo
Problem
Creating Bitbucket Cloud repository in Bamboo will have the following error:
Failed to load data from Bitbucket. [500 Internal Server Error]
The following appears in the atlassian-bamboo.log
2017-03-10 10:54:23,378 INFO [http-nio-8085-exec-7] [AccessLogFilter] username POST http://bamboo:8085/rest/hg/latest/bb/repositories/ 426572kb
2017-03-10 10:54:24,251 ERROR [http-nio-8085-exec-7] [ThrowableExceptionMapper] Uncaught exception thrown by REST service: 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
java.lang.RuntimeException: 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
at com.atlassian.bamboo.rest.utils.RESTCall.execute(RESTCall.java:197)
at com.atlassian.bamboo.plugins.bitbucket.impl.BitbucketApiServiceImpl.getXmlResponseFromUrl(BitbucketApiServiceImpl.java:191)
at com.atlassian.bamboo.plugins.bitbucket.impl.BitbucketApiServiceImpl.getRepositories(BitbucketApiServiceImpl.java:91)
at com.atlassian.bamboo.plugins.bitbucket.rest.resource.BitbucketResource.lambda$getAvailableRepositories$0(BitbucketResource.java:85)
at com.atlassian.bamboo.plugins.bitbucket.rest.resource.BitbucketResource.executeCall(BitbucketResource.java:313)
at com.atlassian.bamboo.plugins.bitbucket.rest.resource.BitbucketResource.getAvailableRepositories(BitbucketResource.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Diagnosis
Diagnostic Steps
Use the SSLPoke in Unable to Connect to SSL Services Due to 'PKIX Path Building Failed' Error to perform the following command:
java SSLPoke bitbucket.org 443
If it fail, run the following command:
/path/to/java/bin/keytool -list -v -keystore /path/to/java/jre/lib/security/cacerts > ca-list.txt
- Compare it with the JDK in Oracle website
Cause
The existing cacerts
file in the JDK installed in the machine hosting Bamboo, is missing the trusted CA certificate used by Bitbucket Cloud.
Resolution
- Shutdown Bamboo
- Uninstall the JDK in the machine hosting Bamboo
- Download and install JDK 8 from Oracle website
- Make sure that
JAVA_HOME
environment variable is set to the installed JDK - Restart Bamboo
Last modified on Mar 15, 2017
Powered by Confluence and Scroll Viewport.