'Unable to synchronise directory' Due to Duplicate Groups in an External Directory
Synchronization of directories fails. The following appears in the
2012-06-04 12:18:44,664 QuartzWorker-1 ERROR ServiceRunner [atlassian.crowd.directory.DbCachingDirectoryPoller] Error occurred while refreshing the cache for directory [ 10200 ]. com.atlassian.crowd.exception.OperationFailedException: Unable to synchronise directory: duplicate groups with name 'IT' at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseMemberships(AbstractCacheRefresher.java:131)
2011-11-02 09:18:19,790 QuartzWorker-0 ERROR ServiceRunner [atlassian.crowd.directory.DbCachingDirectoryPoller] Error occurred while refreshing the cache for directory [ 10000 ]. com.atlassian.crowd.embedded.ofbiz.db.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting:[GenericEntity:Group][id,12711][groupName,IT][updatedDate,2011-11-02 09:18:19.732][description,Testing][directoryId,10000][lowerDescription,testing][active,1][local,0][type,GROUP][lowerGroupName,it][createdDate,2011-11-02 09:18:19.732] (SQL Exception while executing the following:INSERT INTO cwd_group (ID, group_name, lower_group_name, active, local, created_date, updated_date, description, lower_description, group_type, directory_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry 'it-10000' for key 2)) at com.atlassian.crowd.embedded.ofbiz.db.OfBizHelper.createValue(OfBizHelper.java:167) at com.atlassian.crowd.embedded.ofbiz.OfBizGroupDao.add(OfBizGroupDao.java:154) at com.atlassian.crowd.embedded.ofbiz.OfBizGroupDao.add(OfBizGroupDao.java:140)
Occurs when using *Read Only, with Local Groups* or *Read/Write* LDAP Permissions in your directory connector.
This issue is caused by there being multiple groups in your external directory with the same name (could be different cases name).
If you want to use some of your groups then you must configure your Group Object Filter in the Group Schema Settings of your connector to not include the groups causing issues. Example:
If you want to use groups only in JIRA, and exclude all of the groups in your directory then you can specify a bogus objectCategory. Example: