java.lang.IllegalStateException: User 'johndoe' exists but has no unique key mapping.

Atlassian JIRA | Janet Albion [Atlassian] | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Steps to reproduce: # configure JIRA connected to Crowd and connect it to LDAP # create username in LDAP with trailing space . Eg: "johndoe " (please note the white space) # synchronize Crowd with LDAP # synchronize JIRA with Crowd # (not a bug) user will be able to login with the trailing space. (i) in the database, run the queries below: {code:sql} SELECT concat('-',lower_user_name,'-'),hex(concat('-',lower_user_name,'-')) FROM cwd_user where lower_user_name like '%johndoe%'; +---------------------------------+--------------------------------------+ | concat('-',lower_user_name,'-') | hex(concat('-',lower_user_name,'-')) | +---------------------------------+--------------------------------------+ | -johndoe - | 2D7468796D65202D | +---------------------------------+--------------------------------------+ 1 row in set (0.00 sec) mysql> SELECT concat('-',lower_user_name,'-'),hex(concat('-',lower_user_name,'-')) , concat('-',user_key,'-'), hex(concat('-',user_key,'-')) FROM app_user where lower_user_name like '%johndoe%'; +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ | concat('-',lower_user_name,'-') | hex(concat('-',lower_user_name,'-')) | concat('-',user_key,'-') | hex(concat('-',user_key,'-')) | +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ | -johndoe - | 2D7468796D65202D | -johndoe - | 2D7468796D65202D | +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ 1 row in set (0.00 sec) {code} # rename the user in LDAP, remove the trailing space. i.e : username become "johndoe" (minus the whitespace at the end) # synchronize Crowd with LDAP # synchronize JIRA with Crowd # (BUG) in JIRA UI, navigate to _Administrations > Users > select on the username > JIRA throws error: {code} Cause Referer URL: https://jira.example.com/jira/secure/admin/user/UserBrowser.jspa java.lang.IllegalStateException: User 'johndoe' exists but has no unique key mapping. Hide stack trace java.lang.IllegalStateException: User 'johndoe' exists but has no unique key mapping. at com.atlassian.jira.user.util.DefaultUserManager.getUserByName(DefaultUserManager.java:262) at com.atlassian.jira.web.action.admin.user.ViewUser.getApplicationUser(ViewUser.java:82) at com.atlassian.jira.web.action.admin.user.ViewUser.getUser(ViewUser.java:75) {code} (i) in the database, run the SQL queries below: {code:sql} SELECT concat('-',lower_user_name,'-'),hex(concat('-',lower_user_name,'-')) FROM cwd_user where lower_user_name like '%johndoe%'; +---------------------------------+--------------------------------------+ | concat('-',lower_user_name,'-') | hex(concat('-',lower_user_name,'-')) | +---------------------------------+--------------------------------------+ | -johndoe- | 2D7468796D65202D | +---------------------------------+--------------------------------------+ 1 row in set (0.00 sec) mysql> SELECT concat('-',lower_user_name,'-'),hex(concat('-',lower_user_name,'-')) , concat('-',user_key,'-'), hex(concat('-',user_key,'-')) FROM app_user where lower_user_name like '%thyme%'; +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ | concat('-',lower_user_name,'-') | hex(concat('-',lower_user_name,'-')) | concat('-',user_key,'-') | hex(concat('-',user_key,'-')) | +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ | -johndoe - | 2D7468796D65202D | -johndoe - | 2D7468796D65202D | +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ 1 row in set (0.00 sec) {code} (!) we can see here that the app_user table is not updated even though the cwd_user table was updated after the synchronization. This mismatch cause the error to be thrown. h4.Workaround * the workaround at [JIRA Login Fails With the Message - User exists but has no unique key mapping|https://confluence.atlassian.com/display/JIRAKB/JIRA+Login+Fails+With+the+Message+-+User+exists+but+has+no+unique+key+mapping] can be used.

    Atlassian JIRA | 3 years ago | Janet Albion [Atlassian]
    java.lang.IllegalStateException: User 'johndoe' exists but has no unique key mapping.
  2. 0

    Steps to reproduce: # configure JIRA connected to Crowd and connect it to LDAP # create username in LDAP with trailing space . Eg: "johndoe " (please note the white space) # synchronize Crowd with LDAP # synchronize JIRA with Crowd # (not a bug) user will be able to login with the trailing space. (i) in the database, run the queries below: {code:sql} SELECT concat('-',lower_user_name,'-'),hex(concat('-',lower_user_name,'-')) FROM cwd_user where lower_user_name like '%johndoe%'; +---------------------------------+--------------------------------------+ | concat('-',lower_user_name,'-') | hex(concat('-',lower_user_name,'-')) | +---------------------------------+--------------------------------------+ | -johndoe - | 2D7468796D65202D | +---------------------------------+--------------------------------------+ 1 row in set (0.00 sec) mysql> SELECT concat('-',lower_user_name,'-'),hex(concat('-',lower_user_name,'-')) , concat('-',user_key,'-'), hex(concat('-',user_key,'-')) FROM app_user where lower_user_name like '%johndoe%'; +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ | concat('-',lower_user_name,'-') | hex(concat('-',lower_user_name,'-')) | concat('-',user_key,'-') | hex(concat('-',user_key,'-')) | +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ | -johndoe - | 2D7468796D65202D | -johndoe - | 2D7468796D65202D | +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ 1 row in set (0.00 sec) {code} # rename the user in LDAP, remove the trailing space. i.e : username become "johndoe" (minus the whitespace at the end) # synchronize Crowd with LDAP # synchronize JIRA with Crowd # (BUG) in JIRA UI, navigate to _Administrations > Users > select on the username > JIRA throws error: {code} Cause Referer URL: https://jira.example.com/jira/secure/admin/user/UserBrowser.jspa java.lang.IllegalStateException: User 'johndoe' exists but has no unique key mapping. Hide stack trace java.lang.IllegalStateException: User 'johndoe' exists but has no unique key mapping. at com.atlassian.jira.user.util.DefaultUserManager.getUserByName(DefaultUserManager.java:262) at com.atlassian.jira.web.action.admin.user.ViewUser.getApplicationUser(ViewUser.java:82) at com.atlassian.jira.web.action.admin.user.ViewUser.getUser(ViewUser.java:75) {code} (i) in the database, run the SQL queries below: {code:sql} SELECT concat('-',lower_user_name,'-'),hex(concat('-',lower_user_name,'-')) FROM cwd_user where lower_user_name like '%johndoe%'; +---------------------------------+--------------------------------------+ | concat('-',lower_user_name,'-') | hex(concat('-',lower_user_name,'-')) | +---------------------------------+--------------------------------------+ | -johndoe- | 2D7468796D65202D | +---------------------------------+--------------------------------------+ 1 row in set (0.00 sec) mysql> SELECT concat('-',lower_user_name,'-'),hex(concat('-',lower_user_name,'-')) , concat('-',user_key,'-'), hex(concat('-',user_key,'-')) FROM app_user where lower_user_name like '%thyme%'; +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ | concat('-',lower_user_name,'-') | hex(concat('-',lower_user_name,'-')) | concat('-',user_key,'-') | hex(concat('-',user_key,'-')) | +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ | -johndoe - | 2D7468796D65202D | -johndoe - | 2D7468796D65202D | +---------------------------------+--------------------------------------+--------------------------+-------------------------------+ 1 row in set (0.00 sec) {code} (!) we can see here that the app_user table is not updated even though the cwd_user table was updated after the synchronization. This mismatch cause the error to be thrown. h4.Workaround * the workaround at [JIRA Login Fails With the Message - User exists but has no unique key mapping|https://confluence.atlassian.com/display/JIRAKB/JIRA+Login+Fails+With+the+Message+-+User+exists+but+has+no+unique+key+mapping] can be used.

    Atlassian JIRA | 3 years ago | Janet Albion [Atlassian]
    java.lang.IllegalStateException: User 'johndoe' exists but has no unique key mapping.

    Root Cause Analysis

    1. java.lang.IllegalStateException

      User 'johndoe' exists but has no unique key mapping.

      at com.atlassian.jira.user.util.DefaultUserManager.getUserByName()
    2. com.atlassian.jira
      ViewUser.getUser
      1. com.atlassian.jira.user.util.DefaultUserManager.getUserByName(DefaultUserManager.java:262)
      2. com.atlassian.jira.web.action.admin.user.ViewUser.getApplicationUser(ViewUser.java:82)
      3. com.atlassian.jira.web.action.admin.user.ViewUser.getUser(ViewUser.java:75)
      3 frames