Elasticsearch suddenly stops working with error java.security.cert.CertificateExpiredException in Bitbucket

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Code search suddenly stops working in Bitbucket Data Center with a remote ElasticSearch instance.

Environment

Bitbucket Data Center: Any version with a remote ElasticSearch instance.

Diagnosis

You would see an error like below in the atlassian-bitbucket.log, right after the start-up of the instance when Bitbucket is trying connect to ElasticSearch for the first time:

1 2 3 4 5 6 2022-03-28 22:55:58,610 ERROR [Caesium-1-4] c.a.b.i.s.i.IndexingSynchronizationService An error was encountered while checking or creating the mapping in Elasticsearch com.atlassian.bitbucket.internal.search.indexing.exceptions.IndexException: Unable to check whether a valid mapping exists in Elasticsearch ... Caused by: java.util.concurrent.ExecutionException: javax.net.ssl.SSLHandshakeException: PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failed ... Caused by: java.security.cert.CertificateExpiredException: NotAfter: Thu Mar 24 06:00:00 GMT-06:00 2022

Cause

The error CertificateExpiredException indicates that the certificate that's applied on the ElasticSeach instance was expired on the date mentioned in the log entry. In the example above, it got expired on March 24 2022.

Solution

You will need to update the certificate in the cert store of the remote Elastic search instance to one that hasn't expired. 

If you still have any issues with search after that, please get in touch with Atlassian Support.

Updated on February 24, 2025

Still need help?

The Atlassian Community is here for you.