Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,331,458
Community Members
 
Community Events
169
Community Groups

Errror Creating bean with name 'userManager'

Hello everybody.

I'm currently developing a confluence Plugin, which need access to the Conflunece UserManager.

This worked the last weeks, but since 2 days im getting the following Exception:

Error creating bean with name 'userManager': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/springframework/osgi/context/internal/classloader/ChainedClassLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"
   at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:127)

 

this is my atlassian-plugin.xml

<component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager"/>
<component-import key="loginUriProvider" interface="com.atlassian.sal.api.auth.LoginUriProvider"/>

 

I'm accessing the UserManager through constructor DI

private BandanaManager manager;
private UserManager userManager;
private UserAccessor userAccessor;
 
public UsageClass(BandanaManager manager, UserManager userManager, UserAccessor userAccessor) {
    this.manager = manager;
    this.userManager = userManager;
    this.userAccessor = userAccessor;
}

 

I Have no idea where this error comes from.

 

I hope for some advice 

Lars Kölpin

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted

It seems like a new dependency 

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>provided</scope>
</dependency>

 solved the issue

Sorry for the late reply, but it could help people facing this.

In my opinion, the error appeared after you added a dependency that brought it's own dependency, that overrides one or more of servlet api classes. This could be a networking library redefinind Request class, for example. In this case, the overriden class takes precendence over the class provided by servlet-api, and of course jira classes depending on it fail to load.

Adding the servlet-api dependency as a top-level class may solve you immediate problem, but it may break the networking api (if you added a networking api :) ), because its Request class will be overriden (or not, depending on how dependencies are managed, bundled or not).

To solve this, the cleanest way (provided you removed the dependency that introduced the problem), is to remove the target dependency and rebuild your plugin from scratch. 

TAGS

Atlassian Community Events