Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira refuses to create users through API sometimes after rebooting

Igor Loskutov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 25, 2013

Hi. Sometimes I can't create users after rebooting.

I can fix it by second/third/etc reboot.

I did some debugging and found that it really create user but give me some error message about groups.

I checked user and found that it didn't added to any group (jira-users too).

After trying to add this new user to group I get error message.

In my JIRA instance I have my own email handlers that I coded for process customers reports.

It create user for each customer email but don't add them to jira-users because they don't need to login in jira and used only as customer information storage.

I overwrite com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler's method createUserForReporter to debug this problem and it seems that it fails on this line:

reporter = context.createUser(reporterEmail, password, reporterEmail, fullName, null);

where I can this stack trace:

2013-02-26 01:52:50,446 QuartzWorker-0 WARN ServiceRunner MPS Main plugins.mail.mpsmailhandler.MPSMessageHandler create exception

com.atlassian.crowd.exception.runtime.UserNotFoundException: Userdoes not exist

at com.atlassian.crowd.embedded.core.CrowdServiceImpl.addUserToGroup(CrowdServiceImpl.java:684)

at com.atlassian.crowd.embedded.core.DelegatingCrowdService.addUserToGroup(DelegatingCrowdService.java:160)

at com.atlassian.crowd.embedded.core.FilteredCrowdServiceImpl.addUserToGroup(FilteredCrowdServiceImpl.java:288)

at com.atlassian.jira.user.util.UserUtilImpl.doAddUserToGroup(UserUtilImpl.java:521)

at com.atlassian.jira.user.util.UserUtilImpl.addToJiraUsePermission(UserUtilImpl.java:872)

at com.atlassian.jira.user.util.UserUtilImpl.createUserNoNotification(UserUtilImpl.java:278)

at com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createUser(DefaultMessageHandlerContext.java:50)

at com.atlassian.jira.service.services.mail.DelegatingMessageHandlerContext.createUser(DelegatingMessageHandlerContext.java:37)

at ru.megaplan.jira.plugins.mail.mpsmailhandler.MPSMessageHandler.createUserDebug(MPSMessageHandler.java:408)

at ru.megaplan.jira.plugins.mail.mpsmailhandler.MPSMessageHandler.createUserForReporter(MPSMessageHandler.java:328)

Problem is that default UserUtilImpl first create user and then trying to add it to group but can't find this user in some inner call from

com.atlassian.crowd.embedded.core.CrowdServiceImpl.addUserToGroup(CrowdServiceImpl.java:684)

I done some additional source code review and found that most likely this call fails somewhere in

com/atlassian/crowd/directory/DbCachingRemoteDirectory

where gets through src/main/java/com/atlassian/crowd/manager/application/ApplicationServiceGeneric 's fastFailingFindUser

and through com/atlassian/crowd/embedded/core/CrowdServiceImpl

and so on.

I have default JIRA user directory.

I found exactly same problem in Atlassian Answers

https://answers.atlassian.com/questions/114965/get-an-error-when-attempting-to-add-a-new-user-to-jira?page=1#118506

but it wasn't resolved there.

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Andrzej Pasterczyk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2013

Have you tried to split this into separate calls like find out user (e.g. by AbstractMessageHandler.getReporter), then use https://docs.atlassian.com/jira/latest/com/atlassian/jira/user/util/UserUtil.html to create user and finally add that user to group. If you still get that behavior maybe some short delay between creating user and adding to group would help since you point to DbCachingRemoteDirectory (even though not an ideal solution).

0 votes
LucasA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 8, 2013

Hi,

Once we already have a cause for this issue, we have to find how to fix it. Please raise a support ticket at https://support.atlassian.com, attaching all the log files and making a small briefing about your actual environment.

Lucas Lima

Atlassian Support

TAGS
AUG Leaders

Atlassian Community Events