Duplicate versions of the same plugin cause Confluence to render broken, "Page Not Found" pages
Problem
Confluence will start up, but it appears broken:
The following appears in the logs during start up:
2015-04-21 03:09:20,737 ERROR [localhost-startStop-1] [atlassian.confluence.plugin.PluginFrameworkContextListener] contextInitialized Error initialising plugin manager:
Cannot write plugin data to the filesystem: /local/1/sw/fid/build/confluence/confluence-home/plugins-cache/1429095103000analytics-whitelist-3.24.jar
java.lang.RuntimeException: Cannot write plugin data to the filesystem: /local/1/sw/fid/build/confluence/confluence-home/plugins-cache/1429095103000analytics-whitelist-3.24.jar
at com.atlassian.confluence.plugin.DatabasePluginScanner.writePluginData(DatabasePluginScanner.java:139)
at com.atlassian.confluence.plugin.DatabasePluginScanner.loadNewPluginsFromDatabase(DatabasePluginScanner.java:164)
at com.atlassian.confluence.plugin.DatabasePluginScanner.scan(DatabasePluginScanner.java:68)
at com.atlassian.plugin.loaders.ScanningPluginLoader.loadAllPlugins(ScanningPluginLoader.java:85)
at com.atlassian.plugin.loaders.ForwardingPluginLoader.loadAllPlugins(ForwardingPluginLoader.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy15.loadAllPlugins(Unknown Source)
at com.atlassian.plugin.loaders.PermissionCheckingPluginLoader.loadAllPlugins(PermissionCheckingPluginLoader.java:24)
at com.atlassian.plugin.manager.DefaultPluginManager.earlyStartup(DefaultPluginManager.java:371)
at com.atlassian.confluence.plugin.ConfluencePluginManager.earlyStartup(ConfluencePluginManager.java:130)
at com.atlassian.plugin.manager.DefaultPluginManager.init(DefaultPluginManager.java:349)
at com.atlassian.confluence.plugin.PluginFrameworkContextListener.contextInitialized(PluginFrameworkContextListener.java:59)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:162)
at java.io.BufferedInputStream.read(BufferedInputStream.java:325)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1025)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:999)
at com.atlassian.confluence.plugin.DatabasePluginScanner.writePluginData(DatabasePluginScanner.java:134)
... 30 more
Diagnosis
This error can also be thrown if the operating system user that's running Confluence doesn't have write access to the home directory. Please ensure that all files and folders in the home directory are owned by the user running Confluence and that they have read and write permissions across the full home directory.
Cause
There are multiple versions of the same plugin in the instance. Confluence bundles a number a plugins, but it's also possible to install these plugins manually, or have them be installed as part of other plugin installations. To fix this, we need to delete one of them.
In the case above, version 3.24 of the analytics-whitelist was added to the Confluence database of a 5.6.4 instance, in which 3.31 is the default bundled version.
Resolution
Remove the non-bundled version of the plugin from the instance. Note the name of the plugin from the stack trace. In this example, it is: analytics-whitelist-3.24
.
To find out which version is bundled, go to <confluence-install>/confluence/WEB-INF/atlassian-bundled-plugins
and search for the name of the plugin. This is the version that you should keep.
Next, run the following SQL query:
select * from PLUGINDATA;
Find the plugin that matches the one from your stack trace and then delete it from the PLUGINDATA table:
Backup the database before executing the deletion task. If unsure, please reach out to Atlassian Support.
delete from PLUGINDATA where pluginkey like '%<plugin_name>%'