I have a web panel that uses jira's internal provider called "MultiContextProvider" as below:
<web-panel key="linkingmodule" location="atl.jira.view.issue.left.context" weight="400">
<context-provider class="com.atlassian.jira.plugin.webfragment.contextproviders.MultiContextProvider">
<param name="pluginKey">${atlassian.plugin.key}</param>
<param name="ctxProvider-1">com.atlassian.jira.plugin.webfragment.contextproviders.I18nContextProvider</param>
<param name="ctxProvider-2">com.atlassian.jira.plugin.webfragment.contextproviders.BaseUrlContextProvider</param>
<param name="ctxProvider-4">com.atlassian.jira.plugin.webfragment.contextproviders.XsrfTokenContextProvider</param>
</context-provider>
<resource location="/templates/com/mgmtp/jira/addon/viewissue/linkblock.vm" name="view" type="velocity"/>
<resource location="/templates/com/mgmtp/jira/addon/viewissue/throbber.gif" name="throbber" type="download">
<param name="content-type" value="image/gif"/>
</resource>
<condition class="com.atlassian.jira.plugin.webfragment.conditions.LinkingEnabledCondition"/>
<label key="common.concepts.issuelinks"/>
</web-panel>
After I apply spring scanner 2.1.8 for my plugin, I got the error: Error creating bean with name 'com.atlassian.jira.plugin.webfragment.contextproviders.MultiContextProvider':
[INFO] [talledLocalContainer] Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.atlassian.jira.plugin.webfragment.contextproviders.MultiContextProvider': Unsatisfied dependency expressed through constructor argument with index 1 of type [com.atlassian.plugin.web.WebFragmentHelper]: No qualifying bean of type [com.atlassian.plugin.web.WebFragmentHelper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.plugin.web.WebFragmentHelper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:185)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:342)
[INFO] [talledLocalContainer] ... 2 filtered
[INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] [talledLocalContainer] at com.atlassian.plugin.osgi.spring.DefaultSpringContainerAccessor.createBean(DefaultSpringContainerAccessor.java:97) [INFO] [talledLocalContainer] at com.atlassian.jira.plugin.PluginInjector.newInstance(PluginInjector.java:27)
[INFO] [talledLocalContainer] at com.atlassian.jira.plugin.webfragment.JiraWebFragmentHelper.loadContextProvider(JiraWebFragmentHelper.java:55)
[INFO] [talledLocalContainer] ... 48 more
[INFO] [talledLocalContainer] Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.plugin.web.WebFragmentHelper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
I have imported the package "com.atlassian.plugin.web" into the instruction part in pom file, but it still doesn't work. My pom file look a part like below:
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<!-- These two lines is to enable QuickReload-->
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<!-- See here for an explanation of default instructions: -->
<!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<Export-Package/>
<!-- Add package import here -->
<Import-Package>
com.atlassian.jira.plugin.webfragment.contextproviders,
com.atlassian.sal.api.lifecycle,
com.atlassian.jira.security.xsrf,
com.atlassian.plugin.web,
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*;resolution:="optional"
</Import-Package>
<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
My plugin works well without spring scanner. Can someone tell me what I did wrong and how to resolve it. Thanks a lot!
I know it's a late answer but it might help other (unfortunate) atlassian developers. In your plugin config, there is the "Import-Package" section which is related to OSGI resolution. Whenever you encounter an error like the one given in your stacktrace
No qualifying bean of type [com.atlassian.plugin.web.WebFragmentHelper] found
the solution is to make resolution of this package optional:
com.atlassian.plugin.web;resolution:="optional",
and OMG don't forget the f**** COMMA at the end because the parser responsible for generating the corresponding entries in the xml deployment descriptor will silently ignore all following definitions and you end up with missing classes on other packages. It's a nightmare if you are unfamiliar with such hidden mechanisms.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.