Novelle Directory User Synchronisation Failed with Duplicate Result Error
Symptoms
Confluence fails to synchronise with a Novelle LDAP Directory.
The following appears in the atlassian-confluence.log
with DEBUG and TRACE log enabled:
2014-04-23 17:15:53,022 DEBUG [scheduler_Worker-3] [springframework.orm.hibernate.HibernateTemplate] execute Not closing pre-bound Hibernate Session after HibernateTemplate
2014-04-23 17:15:53,024 TRACE [http-18092-4] [springframework.transaction.interceptor.TransactionInterceptor] prepareTransactionInfo Getting transaction for [com.atlassian.user.GroupManager.getGroup]
2014-04-23 17:15:53,025 TRACE [scheduler_Worker-3] [springframework.transaction.interceptor.TransactionInterceptor] completeTransactionAfterThrowing Completing transaction for [com.atlassian.crowd.embedded.spi.UserDao.findByExternalId] after exception: org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 3
Diagnosis
- Check the occurrence of the
scheduler_Worker-3
thread and look for the nearest 'select
' query Extract the DEBUG and TRACE log with
scheduler_Worker-3
threads:2014-04-23 17:15:52,828 DEBUG [scheduler_Worker-3] [net.sf.hibernate.SQL] log select this.id as id0_, this.user_name as user_name0_, this.lower_user_name as lower_us3_0_, this.active as active0_, this.created_date as created_5_0_, this.updated_date as updated_6_0_, this.first_name as first_name0_, this.lower_first_name as lower_fi8_0_, this.last_name as last_name0_, this.lower_last_name as lower_l10_0_, this.display_name as display11_0_, this.lower_display_name as lower_d12_0_, this.email_address as email_a13_0_, this.lower_email_address as lower_e14_0_, this.external_id as externa15_0_, this.directory_id as directo16_0_, this.credential as credential0_ from cwd_user this where this.directory_id=? and this.external_id=? 2014-04-23 17:15:52,828 TRACE [scheduler_Worker-3] [sf.hibernate.impl.BatcherImpl] getPreparedStatement preparing statement 2014-04-23 17:15:52,828 TRACE [scheduler_Worker-3] [sf.hibernate.type.LongType] nullSafeSet binding '144211969' to parameter: 1 2014-04-23 17:15:52,829 TRACE [scheduler_Worker-3] [sf.hibernate.type.StringType] nullSafeSet binding 'j???7?w %P' to parameter: 2 2014-04-23 17:15:52,830 TRACE [scheduler_Worker-3] [sf.hibernate.loader.Loader] doQuery processing result set 2014-04-23 17:15:52,833 TRACE [scheduler_Worker-3] [sf.hibernate.type.LongType] nullSafeGet returning '144310333' as column: id0_ 2014-04-23 17:15:52,834 DEBUG [scheduler_Worker-3] [sf.hibernate.loader.Loader] getRow result row: 144310333 2014-04-23 17:15:52,838 TRACE [scheduler_Worker-3] [sf.hibernate.loader.Loader] loadFromResultSet Initializing object from ResultSet: 144310333 2014-04-23 17:15:52,841 TRACE [scheduler_Worker-3] [sf.hibernate.loader.Loader] hydrate Hydrating entity: com.atlassian.crowd.model.user.InternalUser#144310333 2014-04-23 17:15:52,845 TRACE [scheduler_Worker-3] [sf.hibernate.type.StringType] nullSafeGet returning 'p0479' as column: user_name0_ 2014-04-23 17:15:52,847 TRACE [scheduler_Worker-3] [sf.hibernate.type.StringType] nullSafeGet returning 'p0479' as column: lower_us3_0_ 2014-04-23 17:15:52,851 TRACE [scheduler_Worker-3] [sf.hibernate.type.TrueFalseType] nullSafeGet returning 'true' as column: active0_ 2014-04-23 17:15:52,854 TRACE [scheduler_Worker-3] [sf.hibernate.type.TimestampType] nullSafeGet returning '2014-04-11 11:05:34' as column: created_5_0_ 2014-04-23 17:15:52,861 TRACE [scheduler_Worker-3] [sf.hibernate.type.TimestampType] nullSafeGet returning '2014-04-11 11:05:34' as column: updated_6_0_ ... 2014-04-23 17:15:52,893 TRACE [scheduler_Worker-3] [sf.hibernate.loader.Loader] loadFromResultSet Initializing object from ResultSet: 144310334 2014-04-23 17:15:52,896 TRACE [scheduler_Worker-3] [sf.hibernate.loader.Loader] hydrate Hydrating entity: com.atlassian.crowd.model.user.InternalUser#144310334 2014-04-23 17:15:52,897 TRACE [scheduler_Worker-3] [sf.hibernate.type.StringType] nullSafeGet returning 'p0442' as column: user_name0_ 2014-04-23 17:15:52,899 TRACE [scheduler_Worker-3] [sf.hibernate.type.StringType] nullSafeGet returning 'p0442' as column: lower_us3_0_ ... 2014-04-23 17:15:52,932 TRACE [scheduler_Worker-3] [sf.hibernate.loader.Loader] loadFromResultSet Initializing object from ResultSet: 144310339 2014-04-23 17:15:52,937 TRACE [scheduler_Worker-3] [sf.hibernate.loader.Loader] hydrate Hydrating entity: com.atlassian.crowd.model.user.InternalUser#144310339 2014-04-23 17:15:52,938 TRACE [scheduler_Worker-3] [sf.hibernate.type.StringType] nullSafeGet returning 'p0582' as column: user_name0_ 2014-04-23 17:15:52,940 TRACE [scheduler_Worker-3] [sf.hibernate.type.StringType] nullSafeGet returning 'p0582' as column: lower_us3_0_
Cause
The external_id / "ldap.external.id" used in the parameter of synchronisation query is not unique element in the LDAP because it returns more than 1 result.
Resolution
- Navigate to
Confluence Admin >> User Directories
and go toEdit LDAP >> User Schema Settings >> User Unique ID Attribute
Change the current attribute to a unique attribute (contact your LDAP administrator to find out about it)