Confluence startup issue - having to manually clear plugins cache every time
Asked by Jamie Rogers:

Hi Community

We are currently in the process of migrating our Confluence instance off Windows and onto RHEL (7.4 to be specific).

I've noticed something odd with our Confluence install (in a test domain) that every time I need to restart the application I need to clear the plugins cache otherwise Confluence will fail to start. I did not have to do this when Confluence ran on Windows, so I find it rather inconvenient and now wondering if something is not right with our install or environment.

Here is an example of an error in the logs - Googling this brings up several community posts to do with plugins not loading in time to corrupted plugins cache. We already have the plugin delay [300sec time parameter](https://confluence.atlassian.com/doc/configuring-system-properties-168002854.html) added to our JVM config as we've had issues in the past with plugins starting up in time.

```
2018-04-10 08:54:14,605 ERROR [ThreadPoolAsyncTaskExecutor::Thread 8] [plugin.osgi.factory.OsgiPlugin] onPluginContainerFailed Unable to start the plugin container for plugin 'com.atlassian.confluence.plugins.confluence-baseurl-plugin'
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [bundle://233.0:0/META-INF/spring/spring-components.xml]; nested exception is java.lang.IllegalStateException: Cannot execute atlassian-spring-scanner-runtime: plugin has an extra copy of atlassian-spring-scanner-annotation classes, perhaps embedded inside the target plugin 'com.atlassian.confluence.plugins.confluence-baseurl-plugin'; embedding scanner-annotations is not supported since scanner version 2.0. Use 'mvn dependency:tree' and ensure the atlassian-spring-scanner-annotation dependency in your plugin has <scope>provided</scope>, not 'runtime' or 'compile', and you have NO dependency on atlassian-spring-scanner-runtime.
 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
 at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:170)
 at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:140)
 at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
 at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609)
 at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:60)
 at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:242)
 at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
 at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:220)
 at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:224)
 at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:177)
 at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:157)
 at org.eclipse.gemini.blueprint.extender.internal.activator.LifecycleManager$1.run(LifecycleManager.java:207)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Cannot execute atlassian-spring-scanner-runtime: plugin has an extra copy of atlassian-spring-scanner-annotation classes, perhaps embedded inside the target plugin 'com.atlassian.confluence.plugins.confluence-baseurl-plugin'; embedding scanner-annotations is not supported since scanner version 2.0. Use 'mvn dependency:tree' and ensure the atlassian-spring-scanner-annotation dependency in your plugin has <scope>provided</scope>, not 'runtime' or 'compile', and you have NO dependency on atlassian-spring-scanner-runtime.
 at com.atlassian.plugin.spring.scanner.runtime.impl.AtlassianScannerBeanDefinitionParser.checkScannerRuntimeIsNotEmbeddedInBundle(AtlassianScannerBeanDefinitionParser.java:198)
 at com.atlassian.plugin.spring.scanner.runtime.impl.AtlassianScannerBeanDefinitionParser.parse(AtlassianScannerBeanDefinitionParser.java:60)
 at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
 at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1411)
 at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1401)
 at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:168)
 at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:138)
 at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94)
 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
 ... 20 more
```

Previously Confluence was installed as a service on Windows 2012R2 server and have followed the guidance provided by [Atlassian documentation](https://confluence.atlassian.com/doc/migrating-confluence-between-servers-184150.html) with regards to migrating Confluence to a new server. I've installed fresh binaries downloaded from Atlassian (Linux x64) and only copied the *application data* directories (Confluence home) from the previous server. Database remains the same and runs on Oracle.

At this time I am manually starting/stopping Confluence using the shell scripts in the bin directory. I have not yet configured Confluence as a service on RHEL but this would more or less call the same scripts.

Has anyone had a similar problem like this or have any other suggestions?

We are running Confluence 6.7 version.

Regards, Jamie


Answers:
author: Suren Raj
body: Hi, Jamie.

Based on the error message, it seems like some system plugin is not able to start up correctly. In this case, can you try to restore the system plugin state to default and [clear the plugin cache](https://confluence.atlassian.com/confkb/how-to-clear-confluence-plugins-cache-297664846.html) to check if the issue still persists?

* <https://confluence.atlassian.com/confkb/how-to-reset-all-confluence-plugins-back-to-their-default-state-through-the-database-859509873.html>

<br />

(!) **Please remember to generate a database dump backup before performing any changes to the database to avoid any data loss or corruption**.

Kindly let us know how it goes after trying the suggestion.  

Cheers

comments: author: Jamie Rogers
body: Hi Suren

Thanks for the response.

I have tried the suggested fix on this knowledge article and cleared the cache again however I am now facing this issue every restart of Confluence - Even with the plugins cache cleared. The same error messages as described above keep coming up.

I have a support ticket with Atlassian on this issue so will see what they say - perhaps there is some other issue with this instance.

Regards, Jamie