Could not add the following entity to the directory [ Crowd Internal Directory ] : <Username>
Problem
After a incremental or full synchronization is run, the following appears in the atlassian-jira.log
2019-02-06 12:45:23,893 Caesium-1-4 WARN ServiceRunner[c.a.crowd.directory.DbCachingRemoteChangeOperations] Could not add the following entity to the directory [ Crowd Internal Directory ]: <username>
Diagnosis
Environment
This can happen in any environment that synchronizes to LDAP or Active directory. The message says "Crowd Internal Directory" since its not able to add to the cwd_* tables in Jira.
Diagnostic Steps
Set the logging to the following package to TRACE from Administration - > System - > Logging and Profiling - > Package name (com.atlassian.crowd.directory) - > Set it to TRACE
Cause
It was noticed from the debug logging that the same username was identified by two different DN in the same Active Directory, causing the users to be retrieved twice. This can be seen from the log as follows. So when the users are added for the next dn, it gives the warning message.
2019-02-19 09:59:14,504 Caesium-1-2 TRACE ServiceRunner [c.a.c.d.ldap.mapper.UserContextMapper] Created user <com.atlassian.crowd.model.user.LDAPUserWithAttributes@157ec5[dn=cn=svenkata@us.atlas.com,ou=people,dc=wsc,dc=atlas,dc=com,directoryId=10000,name=svenkata@us.atlas.com,active=true,emailAddress=svenkata@us.atlas.com,firstName=shri,lastName=venkat,displayName=shri venkata,externalId=7c536fef-13f6-427d-b55b-b08226b2d0cd,attributes={}]> from DN <cn=svenkata@us.atlas.com,ou=people,dc=wsc,dc=atlas,dc=com>
2019-02-19 09:59:14,536 Caesium-1-2 TRACE ServiceRunner [c.a.c.d.ldap.mapper.UserContextMapper] Created user <com.atlassian.crowd.model.user.LDAPUserWithAttributes@157ec5[dn=cn=svenkata@us.atlas.com,ou=people,dc=wsc,dc=atlas,dc=com,directoryId=10000,name=svenkata@us.atlas.com,active=true,emailAddress=svenkata@us.atlas.com,firstName=shri,lastName=venkat,displayName=shri venkata,externalId=7c536fef-13f6-427d-b55b-b08226b2d0cd,attributes={}]> from DN <uid=svenkata@us.ibm.com,ou=people,dc=wsc,dc=atlas,dc=com>
Resolution
Verify if the Active Directory has multiple domain names by which the users are identified from in the same directory. Remove duplicate entries in the active directory for the same user.