Hi all,
while converting a plug-in from JIRA 3.13. to JIRA 5.0.5 I run into the following problem.
code snipet:
import com.opensymphony.user.UserManager; ... @Override public Object getValueFromIssue(CustomField customField, Issue issue) { ... return getUser(userName); } private User getUser(String userName) { try { return UserManager.getInstance().getUser(userName); } catch (EntityNotFoundException e) { logger.error("error finding the user: " + userName); e.printStackTrace(); } return null; }
maven config:
<dependency> <groupId>opensymphony</groupId> <artifactId>osuser</artifactId> <version>1.0-20060106</version> </dependency>
After starting JIRA 5.0.5 witht he plug-in I got the following error:
[com.opensymphony.user.UserManager] Unable to load configuration com.opensymphony.user.UserManagerImplementationException: The configuration file osuser.xml could not be found.
Afterwards I copied the osuer.xml from WEB-INF/classes of the JIRA 3.13. version tho the WEB-INF/classes of JIRA 5.0.5.
content of osuers.xml:
<provider class="com.atlassian.core.ofbiz.osuser.CoreOFBizCredentialsProvider"> <property name="exclusive-access">true</property> </provider> <provider class="com.opensymphony.user.provider.ofbiz.OFBizProfileProvider"> <property name="exclusive-access">true</property> </provider> <provider class="com.opensymphony.user.provider.ofbiz.OFBizAccessProvider"> <property name="exclusive-access">true</property> </provider>
After restart of JIRA I got this error:
[opensymphony.user.util.ConfigLoader] Could not create instance of provider java.lang.ClassNotFoundException: com.atlassian.core.ofbiz.osuser.CoreOFBizCredentialsProvider
In order to avoid this I added to the maven pom.xml now:
<dependency> <groupId>com.atlassian.ofbiz</groupId> <artifactId>atlassian-ofbiz</artifactId> <version>2.7.3</version> </dependency>
Unfortunately, this didn't help because I got a NullPointerException in my code now:
java.lang.NullPointerException at com.netlinx.plugins.jira.customfields.MyCustomField.getUser(MyCustomField.java:90)
that happens in my code in the following line of my getUser() method
UserManager.getInstance().getUser(userName);
I have no clue why the UserManger returns null ...
Your help is very appreciated. Thanks in advance.
Community moderators have prevented the ability to post new answers.
Ah, that's easy.
You shouldn't be trying to use opensymphony in Jira 5. Don't import it or reference it at all. Undo all the changes you've made in attempting to make it work above, and go back to the Java code.
Replace the import of opensymphony with
import com.atlassian.crowd.embedded.api.User;
You may need to amend more of your user calls as the API for that is a bit different, but it's a starting point.
ok, thanks
I will start with that ....
probably you meant that I need to have
CrowdService CrowdDirectoryService ApplicationProperties
in
UserManager userManager = new DefaultUserManager(crowdService,crowdDirectoryService,applicationProperties);
applicationProperties I have so far, but for the both crowdServices no clue so far ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ComponentManager.getInstance().getUserUtil().getUser(userName);
did the job
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough [Adaptavist]
Hi,
I do not have ComponentManager. Where did you find it?
Thank you in advance ,
Mihai Morareanu
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.