Bitbucket Server Does Not Start - Unable to clean the cache directory

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

Problem

Bitbucket Server does not start, and the following error can be seen in the atlassian-bitbucket.log:

1 2 3 4 5 2012-11-27 11:05:08,255 ERROR [main] o.s.web.context.ContextLoader Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationFilter' defined in class path resource [security-context.xml]: Cannot resolve (...) Invocation of init method failed; nested exception is com.atlassian.plugin.osgi.container.OsgiContainerException: Unable to clean the cache directory: /atlassian-bitbucket-home/plugins/.osgi-cache/felix at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ~[spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]

Cause

Changes in the installed JDK/JRE have caused the compiled plugin JARs to be incompatible, and they need to be regenerated.

Resolution

  1. Stop Bitbucket Server

  2. Create a backup of the BITBUCKET_HOME/plugins/.osgi-cache/felix directory:

    1 cp -r <Bitbucket Server home directory>/plugins/.osgi-cache/felix <Bitbucket Server home directory>/plugins/.osgi-cache/felix.bak
  3. Remove the BITBUCKET_HOME/plugins/.osgi-cache/felix directory.

    ⚠️ Please don't remove directories above .osgi-cache. Bitbucket will not create it. Also, please ensure that .osgi-cache and all the directories below have the same OS user as the owner as the one running Bitbucket.⚠️

    1 rm -rf <Bitbucket Server home directory>/plugins/.osgi-cache/felix
  4. Start Bitbucket Server.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.