LDAP or CROWD Synchronization Fails with java.lang.IllegalStateException: Unable to rename user x to X
Symptoms
Synchronization fails and the following appears in atlassian-confluence.log
:
2013-10-14 13:13:56,551 ERROR [scheduler_Worker-3] [atlassian.crowd.directory.DbCachingDirectoryPoller] pollChanges Error occurred while refreshing the cache for directory [ 622595 ].
java.lang.IllegalStateException: Unable to rename user x to X
Cause
Username case in the cwd_user table is different than the one stored in LDAP.
Workaround 1
Disable incremental synchronization for this user directory and re-run the full synchronization. You can expect it to be completed successfully.
Workaround 2
If workaround 1 fails, please run the following SQL query to manually update the offending entry:
UPDATE cwd_user set user_name='X' WHERE user_name='x' AND directory_id != (SELECT id FROM cwd_directory WHERE directory_name='Confluence Internal Directory');
UPDATE user_mapping set username='X' WHERE username='x';
After that synchronize your user directory and it should complete successfully.