Directory Synchronisation with Crowd fails regarding duplicate entries in database

Still need help?

The Atlassian Community is here for you.

Ask the community


The directories synchronisation will not work due to duplicate entries in the database. This could be due to a possible corruption with the directory. When you try to synchronise the external directories under Confluence Admin > User Directories, the following appears in the atlassian-confluence.log:

INFO [http-8443-31] [embedded.admin.list.DirectoriesController] sync User directory synchronisation requested: [ Crowd Server ], type: [ CROWD ]
INFO [scheduler_Worker-5] [] synchroniseCache synchronisation for directory [ xxxx ] starting
ERROR [scheduler_Worker-5] [sf.hibernate.util.JDBCExceptionReporter] logExceptions Duplicate entry 'xxxxx' for key 'cwd_unique_user_membership'
ERROR [scheduler_Worker-5] [sf.hibernate.impl.SessionImpl] execute Could not synchronize database state with session
INFO [scheduler_Worker-5] [] synchroniseCache failed synchronisation complete in [ 40ms ]
ERROR [scheduler_Worker-5] [] pollChanges Error occurred while refreshing the cache for directory [ xxxxx ].
org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: com.atlassian.crowd.embedded.hibernate2.HibernateMembership#xxxx; SQL []; Duplicate entry 'xxxx' for key 'cwd_unique_user_membership'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'xxxxx' for key 'cwd_unique_user_membership'


A group membership is trying to be synchronised from the remote directory which already exists. When Confluence is trying to add the directory (again) the synchronisation will not be allowed, since duplicate entries are found.


Flushing the cache of the directory will stop the error from happening, and cause the directory to synchronise fully, until the next time a duplicate group membership is sent from the remote directory. The simplest way of forcing this is:

  1. Disable the directory
  2. Enable the directory

Last modified on Mar 30, 2016

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.