Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-70511

Jira will fail to start plugins due to spring scanner library problem v.2 in some plugins

    XMLWordPrintable

Details

    Description

      Summary

      When Jira 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

      2019-06-24 19:17:52,028 ThreadPoolAsyncTaskExecutor::Thread 28 ERROR      [c.a.p.osgi.factory.OsgiPlugin] Unable to start the plugin container for plugin 'com.radiantminds.roadmaps-jira'
      org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [bundle://263.0:0/META-INF/spring/portfolio-root-context.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.radiantminds.roadmaps-jira'; 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.

      Note: Default Jira installation doesn't have this problem. All bundled plugins are compatible .

      Cause

      What is causing these errors is the fact that some of the plugins use 2.x version of atlassian-spring-scanner-annotation dependency in a wrong way.
      Apps are known to have this problem:

      • de.demicon - Image custom field, fixed in latest version
      • de.demicon - Field converter, fixed in latest version
      • Customfield editor plugin v 2.5.0, fixed in 2.5.1
      • JIRA in Motion plugin v1.2.1, fixed in 1.2.5

      Expected scenario

      All of the plugins which use 2.x version of atlassian-spring-scanner-annotation should be fixed. They should use <provided> scope instead of <compile> or <runtime>. After new versions of these plugins are released, they should be used in Jira.
      Instructions on upgrading can be found at atlassian-spring-scanner ReadMe

      Note

      How to find the plugin with atlassian-spring-scanner-annotation.

      1. Since Spring Scanner v2 classes should not be bundled, you can find reduce the scope of suspected plugins by running the following on:
        • JARs in the current directory ($JIRA_HOME/plugins/installed-plugins for Jira Server, or $JIRA_SHARED_HOME/plugins/installed-plugins for Jira Data Center) as follows:
          for i in *.jar; do unzip -v $i | sed "s/^/$i:/" | grep com/atlassian/plugin/spring/scanner/annotation/component/; done
          

          In my case, this returns the name of the offending JAR:

          jira-greenhopper-plugin-7.13.0-DAILY20190329134024.jar:       0  Stored        0   0% 08-21-2014 06:30 00000000  com/atlassian/plugin/spring/scanner/annotation/component/
          jira-greenhopper-plugin-7.13.0-DAILY20190329134024.jar:     422  Defl:N      257  39% 08-21-2014 06:30 28d693c1  com/atlassian/plugin/spring/scanner/annotation/component/Scanned.class
          jira-greenhopper-plugin-7.13.0-DAILY20190329134024.jar:     731  Defl:N      394  46% 08-21-2014 06:30 345abc0d  com/atlassian/plugin/spring/scanner/annotation/component/ConfluenceComponent.class
          ...
          tomcat-filter-0.3.1.jar:       0  Stored        0   0% 06-21-2019 16:25 00000000  com/atlassian/plugin/spring/scanner/annotation/component/
          tomcat-filter-0.3.1.jar:     574  Defl:N      343  40% 05-14-2019 05:35 285fa055  com/atlassian/plugin/spring/scanner/annotation/component/ClasspathComponent.class
          tomcat-filter-0.3.1.jar:     728  Defl:N      396  46% 05-14-2019 05:35 6cd2cf1f  com/atlassian/plugin/spring/scanner/annotation/component/BitbucketComponent.class
          ...
          
      1. Verify with the source code (pom.xml) which atlassian-spring-scanner-annotation is used.
        • In case of V1.x those files are expected
        • In case of V2.x mentioned plugin will cause the problem, in this specific case - tomcat-filter-0.3.1.jar.

      Potential Workaround

      1. For any plugin that failed to start, go to the 'Manage Add-Ons' page in Jira and attempt to manually enable the plugin.
      2. Re-start Jira, and the race condition may not be triggered

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              amacedo@atlassian.com Alessandro Macedo
              Votes:
              20 Vote for this issue
              Watchers:
              49 Start watching this issue

              Dates

                Created:
                Updated: