Hi,
I'm injecting a ThirdPartyPluginLicenseStorageManager reference in an object construtor.
Then I get the exception below:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'thirdPartyPluginLicenseStorageManager' defined in URL [bundle://160.0:0/META-INF/spring/atlassian-plugins-components.xml]: Unsatisfied dependency expressed through constructor argument with index 2 of type [com.atlassian.sal.usercompatibility.UserManager]: : No unique bean of type [com.atlassian.sal.usercompatibility.UserManager] is defined: Unsatisfied dependency of type [interface com.atlassian.sal.usercompatibility.UserManager]: expected at least 1 matching bean; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.atlassian.sal.usercompatibility.UserManager] is defined: Unsatisfied dependency of type [interface com.atlassian.sal.usercompatibility.UserManager]: expected at least 1 matching bean at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:591) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:193) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355) at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.atlassian.sal.usercompatibility.UserManager] is defined: Unsatisfied dependency of type [interface com.atlassian.sal.usercompatibility.UserManager]: expected at least 1 matching bean at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:622) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:584) ... 22 more
Briefly:
The error
Error creating bean with name 'thirdPartyPluginLicenseStorageManager'
is because
No unique bean of type [com.atlassian.sal.usercompatibility.UserManager] is defined: Unsatisfied dependency of type [interface com.atlassian.sal.usercompatibility.UserManager]: expected at least 1 matching bean
The thirdPartyPluginLicenseStorageManager is defined in my atlassian-plugin.xml (it has atomatically added by the Atlassian Plugin SDK):
<component key="thirdPartyPluginLicenseStorageManager" class="com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManagerImpl"/>
I've read the Atlassian documentation:
It suggest to use the @Qualifier annotation to help to Spring to resolve the ambiguity:
I've see that the Atlassian Plugin SDK has also added a reference to the UserManager in my atlassian-plugin.xml file:
<component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager"/>
So I guess that:
@Qualifier("userManager")
should be added to the 3rd paramenter (userManager) in the ThirdPartyPluginLicenseStorageManagerImpl constructor:
public ThirdPartyPluginLicenseStorageManagerImpl(ApplicationProperties applicationProperties, PluginAccessor pluginAccessor, UserManager userManager) { this(applicationProperties, pluginAccessor, userManager, null); }
But, such code is not mine. It's provided by Atlassian in the plugin-license-storage-lib-2.13.3.jar file.
So, how can I resolve the it whether it looks like I need to add a qualifier to a code developed by Atlassian? Or is Spring so flexible to configure it in some way?.
Proposal: Spring name implies a brilliant, warm, happy thing. So, I guess it should be renamed to something more accurate like Advanced Shit.
Thanks,
Pablo
Hi Pablo,
Starting with v2.10.1, the Plugin License Storage library added support for username renaming, which is a new feature in JIRA 6.0 and Confluence 5.3. The API changed slightly to add this support, although it looks like the code generation tool hasn't been updated. (Alternatively, you may be on an older version of the SDK - let me know what version you're currently running).
I've filed https://ecosystem.atlassian.net/browse/PLUG-1045 to fix the codegen tool. In the meantime you can take the following steps to resolve your issue:
More details can be found here: https://bitbucket.org/atlassian/user-compatibility-sal
Cheers,
Ben
P.S. Thanks for the good laugh about the framework rename :)
Hi Ben,
This resolved the problem! The SDK version is the latest available: 4.2.9
Thank you very much!!
Pablo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ben,
Pablo never mentioned the JIRA version he was building for - should we use the version information on this page (Reference: https://ecosystem.atlassian.net/wiki/display/UPM/UPM+Bundling+Matrix) for the version of JIRA we're building for or just use the latest one?
I ask b/c I'm tracking down a SAL CompatibilityUserManager dependency problem and (among other things) switching my UPM License version back to 2.10.1 fixed it. Of course, just now I switched it back to 2.13.3 and it also worked, so something else 'fixed' the issue.
Does using 2.13.3 limit the generated plugin from working with versions of JIRA earlier than 6.1.1?
-wc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using 2.13.3 of the licensing api doesn't restrict you from being compatible with older JIRA versions. If your add-on doesn't work in older versions then something else is likely causing problems.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.