java.lang.IllegalStateException: Unable to rename user bobo.chu to Bobo.Chu

Atlassian JIRA | michael fong | 3 years ago
  1. 0

    I upgraded to v2.9.4 on seeing [ STASH-4154 ] and running into this problem using Confluence v5.3.0 ( and an upgrade to Confluence v5.3.4 corrected problem--thanks ). Same mixed-case username environment with delegated authentication running from ( MS Active Directory ) -> ( Crowd v2.7 ) -> ( Stash v2.9.4; broken-trace below) & ( Confluence v5.3.4; working) For grins tried the checkbox option in Crowd to force all usernames to lowercase and that just caused other usernames to cause the same error. {code} 2013-12-04 12:00:52,871 ERROR [scheduler_Worker-8] c.a.c.d.DbCachingDirectoryPoller Error occurred while refreshing the cache for directory [ 229377 ]. java.lang.IllegalStateException: Unable to rename user Kevin.Barnett to kevin.barnett at com.atlassian.crowd.directory.AbstractInternalDirectory.forceRenameUser(AbstractInternalDirectory.java:620) ~[crowd-persistence-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.updateUsers(DbCachingRemoteChangeOperations.java:229) ~[crowd-core-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.$Proxy1354.updateUsers(Unknown Source) ~[na:na] at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.addOrUpdateCachedUsers(DirectoryCacheImplUsingChangeOperations.java:59) ~[crowd-core-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.ldap.cache.RemoteDirectoryCacheRefresher.synchroniseAllUsers(RemoteDirectoryCacheRefresher.java:68) ~[crowd-ldap-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:78) ~[crowd-ldap-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.ldap.cache.EventTokenChangedCacheRefresher.synchroniseAll(EventTokenChangedCacheRefresher.java:71) ~[crowd-ldap-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:998) ~[crowd-core-2.7.1-rc.jar:na] at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:75) ~[crowd-core-2.7.1-rc.jar:na] at com.sun.proxy.$Proxy114.synchronise(Unknown Source) ~[na:na] at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50) ~[crowd-core-2.7.1-rc.jar:na] at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobBean.executeInternal(DirectoryPollerJobBean.java:29) [crowd-core-2.7.1-rc.jar:na] at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113) [spring-context-support-3.2.4.RELEASE.jar:3.2.4.RELEASE] at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [quartz-1.8.6.jar:na] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [quartz-1.8.6.jar:na] ... 22 frames trimmed Caused by: com.atlassian.crowd.exception.UserAlreadyExistsException: User already exists in directory [229377] with name [Kevin.Barnett] at com.atlassian.stash.internal.crowd.HibernateUserDao.rename(HibernateUserDao.java:144) ~[stash-dao-impl-2.9.3.jar:na] at com.atlassian.stash.internal.crowd.HibernateUserDao.rename(HibernateUserDao.java:50) ~[stash-dao-impl-2.9.3.jar:na] at com.sun.proxy.$Proxy105.rename(Unknown Source) ~[na:na] at com.atlassian.crowd.directory.AbstractInternalDirectory.forceRenameUser(AbstractInternalDirectory.java:615) ~[crowd-persistence-2.7.1-rc.jar:na] ... 15 common frames omitted {code}

    Atlassian JIRA | 3 years ago | Peter Shiner [BOSsAWDs]
    java.lang.IllegalStateException: Unable to rename user Kevin.Barnett to kevin.barnett
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    I upgraded to v2.9.4 on seeing [ STASH-4154 ] and running into this problem using Confluence v5.3.0 ( and an upgrade to Confluence v5.3.4 corrected problem--thanks ). Same mixed-case username environment with delegated authentication running from ( MS Active Directory ) -> ( Crowd v2.7 ) -> ( Stash v2.9.4; broken-trace below) & ( Confluence v5.3.4; working) For grins tried the checkbox option in Crowd to force all usernames to lowercase and that just caused other usernames to cause the same error. {code} 2013-12-04 12:00:52,871 ERROR [scheduler_Worker-8] c.a.c.d.DbCachingDirectoryPoller Error occurred while refreshing the cache for directory [ 229377 ]. java.lang.IllegalStateException: Unable to rename user Kevin.Barnett to kevin.barnett at com.atlassian.crowd.directory.AbstractInternalDirectory.forceRenameUser(AbstractInternalDirectory.java:620) ~[crowd-persistence-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.updateUsers(DbCachingRemoteChangeOperations.java:229) ~[crowd-core-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.$Proxy1354.updateUsers(Unknown Source) ~[na:na] at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.addOrUpdateCachedUsers(DirectoryCacheImplUsingChangeOperations.java:59) ~[crowd-core-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.ldap.cache.RemoteDirectoryCacheRefresher.synchroniseAllUsers(RemoteDirectoryCacheRefresher.java:68) ~[crowd-ldap-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:78) ~[crowd-ldap-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.ldap.cache.EventTokenChangedCacheRefresher.synchroniseAll(EventTokenChangedCacheRefresher.java:71) ~[crowd-ldap-2.7.1-rc.jar:na] at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:998) ~[crowd-core-2.7.1-rc.jar:na] at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:75) ~[crowd-core-2.7.1-rc.jar:na] at com.sun.proxy.$Proxy114.synchronise(Unknown Source) ~[na:na] at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50) ~[crowd-core-2.7.1-rc.jar:na] at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobBean.executeInternal(DirectoryPollerJobBean.java:29) [crowd-core-2.7.1-rc.jar:na] at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113) [spring-context-support-3.2.4.RELEASE.jar:3.2.4.RELEASE] at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [quartz-1.8.6.jar:na] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [quartz-1.8.6.jar:na] ... 22 frames trimmed Caused by: com.atlassian.crowd.exception.UserAlreadyExistsException: User already exists in directory [229377] with name [Kevin.Barnett] at com.atlassian.stash.internal.crowd.HibernateUserDao.rename(HibernateUserDao.java:144) ~[stash-dao-impl-2.9.3.jar:na] at com.atlassian.stash.internal.crowd.HibernateUserDao.rename(HibernateUserDao.java:50) ~[stash-dao-impl-2.9.3.jar:na] at com.sun.proxy.$Proxy105.rename(Unknown Source) ~[na:na] at com.atlassian.crowd.directory.AbstractInternalDirectory.forceRenameUser(AbstractInternalDirectory.java:615) ~[crowd-persistence-2.7.1-rc.jar:na] ... 15 common frames omitted {code}

    Atlassian JIRA | 3 years ago | Peter Shiner [Asurion]
    java.lang.IllegalStateException: Unable to rename user Kevin.Barnett to kevin.barnett
  4. 0

    h3.Steps to reproduce # Create a user with mixed case sensitivity such as "Horatio Nelson" in LDAP # Hook Confluence to the LDAP directory via Internal with LDAP Authentication (Delegated) # Login first as "Horatio Nelson" (to create the user as "Horatio Nelson" in the cwd_user table) # Logout, then login again as "horatio nelson" (all lowercase) You will get this error: {code} 2013-10-11 22:19:58,407 ERROR [http-8443-6] [[Standalone].[localhost].[/c530].[action]] log Servlet.service() for servlet action threw exception java.lang.IllegalStateException: Unable to rename user Horatio Nelson to horatio nelson at com.atlassian.crowd.directory.AbstractInternalDirectory.forceRenameUser(AbstractInternalDirectory.java:611) at com.atlassian.crowd.directory.DelegatedAuthenticationDirectory.authenticateAndUpdateOrCreate(DelegatedAuthenticationDirectory.java:218) at com.atlassian.crowd.directory.DelegatedAuthenticationDirectory.authenticate(DelegatedAuthenticationDirectory.java:175) {code} h3.Cause: The problem is caused by this function in *com.atlassian.crowd.directory.DelegatedAuthenticationDirectory.java*: {code} private User authenticateAndUpdateOrCreate(String name, PasswordCredential credential) throws InactiveAccountException, ExpiredCredentialException, OperationFailedException, InvalidAuthenticationException, UserNotFoundException { // authenticate the user against LDAP User ldapUser = ldapDirectory.authenticate(name, credential); // Try to find the corresponding local user User internalUser = findLocalUserByExternalId(ldapUser.getExternalId()); if (internalUser != null) { if (!internalUser.getName().equals(name)) { // We want to rename the existing user if (isUserUpdateOnAuthEnabled()) { // push any existing user out of our way and rename try { internalUser = internalDirectory.forceRenameUser(internalUser, name); } catch (UserNotFoundException e) { // Pretty unlucky throw new ConcurrentModificationException("Unable to rename '" + internalUser.getName() + "' to new name '" + name + "' during login."); } } {code} Specifically, this if statement: {code} if (!internalUser.getName().equals(name)) {code} Which takes the *name* string directly from the user input, and comparing it to the username stored in cwd_user directly, hence, the mismatch, which is why {{forceRenameUser}} is called in the first place So far, this affects any Confluence distribution bundled with the Crowd 2.7 integration libraries h3.1.Workaround # Login with the *exact* case, in this case, it would be "Horatio Nelson" # Disable "Copy User on Login" for the directory - that will avoid this problem and allow already created users to log in, but no new users will be created automatically on login, and no group updates will be synchronised from the LDAP directory h3.2.Workaround In some cases when disabling such external directory and creating a new one with the same information may fix this problem. Please note that using this workaround will remove all users preferences and profile pictures.

    Atlassian JIRA | 3 years ago | Foogie Sim [Atlassian]
    java.lang.IllegalStateException: Unable to rename user Horatio Nelson to horatio nelson

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Unable to rename user bobo.chu to Bobo.Chu

      at com.atlassian.crowd.directory.AbstractInternalDirectory.forceRenameUser()
    2. com.atlassian.crowd
      AbstractInternalDirectory.forceRenameUser
      1. com.atlassian.crowd.directory.AbstractInternalDirectory.forceRenameUser(AbstractInternalDirectory.java:611)
      1 frame