Confluence does not start due to 'Unable to clean the cache directory' error

Still need help?

The Atlassian Community is here for you.

Ask the community

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

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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

Confluence is unable to start despite working previously.

The following appears in the atlassian-confluence.log:

2011-07-30 12:35:14,918 ERROR [main] [ContainerBase.[Standalone].[localhost].[/]] log Exception sending context initialized event to listener instance of class com.atlassian.config.bootstrap.BootstrappedContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'bundledPluginLoader' while setting constructor argument with index 1 with key [50]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bundledPluginLoader' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'osgiPluginFactory' while setting constructor argument with index 1 with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'osgiPluginFactory' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'osgiPersistentCache' while setting constructor argument with index 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'osgiPersistentCache': FactoryBean threw exception on object creation; nested exception is com.atlassian.plugin.osgi.container.OsgiContainerException: Unable to clean the cache directory: /usr/local/confluence-data/plugins-osgi-cache/felix
:
:
Caused by: com.atlassian.plugin.osgi.container.OsgiContainerException: Unable to clean the cache directory: /usr/local/confluence-data/plugins-osgi-cache/felix
	at com.atlassian.plugin.osgi.container.impl.DefaultOsgiPersistentCache.validate(DefaultOsgiPersistentCache.java:91)
	at com.atlassian.plugin.osgi.container.impl.DefaultOsgiPersistentCache.<init>(DefaultOsgiPersistentCache.java:37)
	at com.atlassian.confluence.plugin.spring.OsgiPersistentCacheFactory.getObject(OsgiPersistentCacheFactory.java:23)
:
:
Caused by: java.io.IOException: Unable to delete file: /usr/local/confluence-data/plugins-osgi-cache/felix/felix-cache/bundle0/bundle.id
	at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1390)
	at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1044)
	at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:977)
	at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1381)
	at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1044)
	at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:977)
	at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1381)
	at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1044)
	at com.atlassian.plugin.osgi.container.impl.DefaultOsgiPersistentCache.validate(DefaultOsgiPersistentCache.java:87)
	... 66 more

Diagnosis

When doing a directory listing of ls -la in <confluence home>/plugins-osgi-cache/felix you can see that the jar files in this directory are owned by different users. A typical scenario is they are owned by root and 'confluence' users.

Cause

Confluence is not able to load/delete some of the plugin jar files in the <confluence home>/plugins-osgi-cache/felix folder because of permission issue.

Resolution

  1. Remove the <confluence home>/plugins-osgi-cache/felix folder
    1. You may need to clear the entire plugins cache, not just the <confluence home>/plugins-osgi-cache/felix
  2. Depending on the OS, perform the following:
    1. For Linux: Restart Confluence as a 'confluence' user. Which is a non-root user created by your system admin to start Confluence. 
    2. For Windows: Right click on <Confluence_Home> and hit Properties. Navigate to the Security Tab and make sure that the user running Confluence has Full Control of this folder. Then startup Confluence again












Last modified on Dec 13, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.