I run in compilator this code,
com.atlassian.jira.user.util.UserManager userManager = ComponentAccessor.getUserManager(); ApplicationUser user = userManager.getUserByName(leadDispayName); String userId=user.getId().toString(); params.put("userId", userId);
And it shows this error:
Unable to run plugin code because of 'java.lang.NoSuchMethodError - com.atlassian.jira.user.ApplicationUser.getId()Ljava/lang/Long;
Community moderators have prevented the ability to post new answers.
My best guess is that you've compiled your code against one version of JIRA and then installed the add-on in a version where the user management has changed. Later versions of JIRA don't have a getID, they use getKey() for a start.
But if I put getKey() it shown me the name admin on the parameter. Not number.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But that's the key you need, the numbers aren't there any more.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But how could I get avatar of user ? If I get img i must put avatarid of user: <img alt="admin" src="http://gzawistowskilp2:2990/jira/secure/useravatar?size=small&ownerId=admin&avatarId=10400">;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, that would have helped earlier in the conversation. AvatarService.getAvatar expects you to give it a *user*, not an ID, so I've no idea why you were looking for the user ID. And, from memory, it can return the absolute URL with a different get function.
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.
But in Avatar I have got still: 9ud fe80:0:0:0:e97c:5225:d756:dce7%16 /projects/TEST [com.atlassian.ozymandias.SafePluginPointAccess] A LinkageError indicates that plugin code was compiled with outdated versions. Unable to run plugin code because of 'java.lang.NoSuchMethodError - com.atlassian.jira.avatar.AvatarService.getAvatarURL(Lcom/atlassian/jira/user/ApplicationUser;Ljava/lang/String;)Ljava/net/URI;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, that goes back to "you've compiled for one version of JIRA and run it on another". Try compiling it on the same version that you're targeting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How could I choose of compilance Version of Jira ? maybe atlas-clean command ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How choose a compilance of version ? in POM I set: <jira.version>6.4.11</jira.version> <amps.version>5.1.16</amps.version> <plugin.testrunner.version>1.2.3</plugin.testrunner.version> <atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version> <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. --> <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key> <!-- TestKit version 6.x for JIRA 6.x --> <testkit.version>6.3.11</testkit.version>
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.
Yes I know this link, but how change compiled for one version of Jira and run in another?
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.
It looks like you are compiling it for version X, and installing in Y. That's all I can tell you from the information here, I don't know how you're managing to do that. Although the answer given a couple of days ago is a possibility.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But now in footer I have got: Atlassian JIRA Project Management Software (v6.4.11#64026-sha1:78f6ec4) like in my POM file: <properties> <jira.version>6.4.11</jira.version> <amps.version>5.1.16</amps.version> <plugin.testrunner.version>1.2.3</plugin.testrunner.version> <atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version> <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. --> <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key> <!-- TestKit version 6.x for JIRA 6.x --> <testkit.version>6.3.11</testkit.version> </properties>
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.
ApplicationUser.getId() appeared only since version 7.0.0 and you are probably compiling against previous JIRA.
Anyway I guess that what you need is userKey: user.getKey() and not id. JIRA DB (at least till 7.0.0) uses userKey varchar(255) as key for the user.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Byt then it write me user name - admin. I want to take user avatar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Zawistowski Grzegorz,
please try user.getKey() instead of Id. The ID of a user is equal to his/her key.
For documentation please refer to:
https://docs.atlassian.com/jira/6.4.1/com/atlassian/jira/user/ApplicationUser.html
Hope this helps.
Cheers,
Mario
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.