外部ディレクトリとの同期がエラー "query did not return unique result due to duplicate groups" で失敗する

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

問題

When doing a manual synchronization or attempting to log in with an external directory, the synchronization fails and few users/groups are synchronized with Confluence.

The following appears in the atlassian-confluence.log

2016-06-13 19:14:43,396 ERROR [scheduler_Worker-5] [atlassian.crowd.directory.DbCachingDirectoryPoller] pollChanges Error occurred while refreshing the cache for directory [ 23625729 ].
org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 2
	at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:590)
	at org.springframework.orm.hibernate.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:353)
	at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:375)
	at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:337)
	at com.atlassian.crowd.embedded.hibernate2.HibernateGroupDao.internalFindByName(HibernateGroupDao.java:359)
	at com.atlassian.crowd.embedded.hibernate2.HibernateGroupDao.findByName(HibernateGroupDao.java:51)
	at com.atlassian.confluence.user.crowd.CachedCrowdGroupDao.lambda$getGroupCache$539(CachedCrowdGroupDao.java:60)
	at com.atlassian.confluence.cache.option.OptionalReadThroughCache.get(OptionalReadThroughCache.java:35)
	at com.atlassian.confluence.user.crowd.CachedCrowdGroupDao.findGroup(CachedCrowdGroupDao.java:88)
	at com.atlassian.confluence.user.crowd.CachedCrowdGroupDao.findByNameWithAttributes(CachedCrowdGroupDao.java:118)

診断

  1. Run the query below to find duplicate groups in the directory mentioned in the error. Replace <DIRECTORY_ID> with the directory mentioned in the error.

    SELECT lower_group_name FROM cwd_group WHERE directory_id='<DIRECTORY_ID>' GROUP BY lower_group_name HAVING (COUNT(lower_group_name) > 1);
  2. If there is no directory ID mentioned in the error, you can run the below query to display any duplicate group names. Then check the directory_id column to verify that the duplicate groups reside in the same directory.

    SELECT lower_group_name FROM cwd_group GROUP BY lower_group_name HAVING (COUNT(lower_group_name) > 1);

原因

This error is caused by: a duplicate value in the database, some corruption in the directory cache, or duplicates in the LDAP.

ソリューション

ソリューション 1

Check for and remove duplicate groups from the external directory

  1. Check the directory from the error for the duplicate groups identified by the diagnostic query.
    1. Remove the duplicates from your external directory
    2. If you're using LDAP you can also configure your Group Object Filter in the Group Schema Settings
  2. If you're not sure which directory it is you can run the following query replacing <DIRECTORY_ID> with the directory mentioned in the error

     SELECT id,directory_name,directory_type,active FROM cwd_directory WHERE id=<DIRECTORY_ID>;
  3. After removing the duplicate groups from the external directory, or if adjusting the Group Object Filter has not resolved the issue:

    1. Disable your external directory

    2. Recreated your external directory with the same configuration settings and synchronize the directory
    3. After a successful full synchronization, verify that users are able to log in and see the same content

ソリューション 2

Remove duplicate groups from the database

If you don't find any duplicates in your external directory, remove the duplicates directly from the cwd_group table.


  1. Run the below query replacing the <GROUP_NAME> with the duplicates displayed from the diagnostic query.

     SELECT * FROM cwd_group WHERE lower_group_name="<GROUP_NAME>";
  2. Check the results and delete the newer group replacing<id_of_duplicated_group> with the id value.

    データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。

     DELETE FROM cwd_group WHERE id='<id_of_duplicated_group>';
  3. Empty the Confluence Cache
    1. Admin > Cache Management > Flush all
  4. Run a full directory synchronization


最終更新日 2019 年 4 月 8 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.