'Unable to synchronise directory' Due to Duplicate Groups in an External Directory
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
Synchronization of directories fails. The following appears in the atlassian-jira.log
:
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)
Diagnosis
Occurs when using *Read Only, with Local Groups* or *Read/Write* LDAP Permissions in your directory connector.
Cause
This issue is caused by there being multiple groups in your external directory with the same name (could be different cases name).
Resolution
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:
(objectCategory=Group)&(!(cn=Users))
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:
(objectCategory=FKSLDJFHNSDUIEWIYFHBYCNWNCEWNFIYWFBLYCINEW)
There is an open bug to improve the handling of this. All users hitting this issue are encouraged to vote and comment on it. JRASERVER-28484 - Improve handling of duplicate group