Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-20306

Jira fails to start plugins due to spring scanner library v.2 in greenhopper plugin

XMLWordPrintable

      Issue Summary

      When App (plugin) is starting up, it scans spring annotations for plugin classes. As part of this scanning process, it tries to ensure that these spring scanner v2.x 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 (Spring Scanner v2.x classes should not be bundled), plugin initialization fails with error:

      2019-10-29 09:33:09,879 ThreadPoolAsyncTaskExecutor::Thread 94 ERROR  /rest/plugins/1.0/available/featured [o.e.g.b.e.i.dependencies.startup.DependencyWaiterApplicationContextExecutor] Unable to create application context for [com.onresolve.jira.groovy.groovyrunner], unsatisfied dependencies: none org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [bundle://337.0:0/META-INF/spring/plugin-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.onresolve.jira.groovy.groovyrunner'; 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.
      

      This affects greenhopper plugin on the following versions

      Jira Version Is Affected?
      7.13.9 NO
      8.0.3 NO
      8.1.3 NO
      8.2.5 NO
      8.3.4 YES
      8.4.2 YES
      8.5.0 YES

      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

      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 (such as $JIRA_HOME/plugins/installed-plugins) 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
          ...
          
      2. 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.

              mzyromski Mikolaj Zyromski
              cchan Chung Park Chan
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: