When Confluence is starting up, it scans spring annotations for plugin classes. As part of this scanning process, it tries to ensure that these spring annotation classes are contained only in single jar. Responsible class for this action is AtlassianScannerBeanDefinitionParser.
If for some reason plugin can see spring annotations from another plugin that bundled them, plugin initialisation fails with error
$ find . -name "atlassian-confluence.log" | xargs grep -h "Cannot execute atlassian-spring-scanner-runtime" | sort -u
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.
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-scheduler-spi'; 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.
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.synchrony-interop'; 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.
The problem here is that plugins from error message have nothing to do with bundling spring scanner. Because of OSGI non-deterministic wiring, these bundles see spring annotation from 'wrong' bundle.
What is causing these errors is the fact that some of the plugins use old 1.x version of atlassian-spring-scanner-annotation dependency. Here is the list of bundled plugins that do it:
- atlassian-authentication-plugin
- ImageEffectsPlugin
- atlassian-webhooks-plugin
- chart-plugin
- confluence-collaborative-editor-plugin
- troubleshooting:plugin-confluence
- atlassian-playbook-blueprints
- synchrony-interop
All of the plugins above (and maybe some more) should be upgraded to use 2.x version of spring scanner annotations. They should also use <provided> scope instead of <compile> or <runtime>. After new versions of these plugins are released, they should be used in Confluence.