Duplicate entry '917507-2130025' for key 'cwd_unique_user_membership'
Asked by Paul:

Hi,

I'm desperately trying to finalise the setup of Confluence/Crowd and JIRA and roll it out (we are in the process of buying the licenses now), but we've hit a roadblock and I need some help.

When trying to sync the Confluence users from our Crowd setup, we are getting the following exception and now we are stuck as many users that we need to setup can't be imported into Confluence. How do I rectify this?

Thanks in advance,

Paul

2012-08-24 19:24:43,933 INFO http-8090-4 embedded.admin.list.DirectoriesController sync User directory synchronisation requested: Crowd Server , type: CROWD

2012-08-24 19:24:43,938 INFO scheduler_Worker-6 atlassian.crowd.directory.DbCachingRemoteDirectory synchroniseCache synchronisation for directory 1310721 starting

2012-08-24 19:24:44,507 ERROR scheduler_Worker-6 sf.hibernate.util.JDBCExceptionReporter logExceptions Duplicate entry '917507-2130025' for key 'cwd_unique_user_membership'

2012-08-24 19:24:44,508 ERROR scheduler_Worker-6 sf.hibernate.impl.SessionImpl execute Could not synchronize database state with session

2012-08-24 19:24:44,509 INFO scheduler_Worker-6 atlassian.crowd.directory.DbCachingRemoteDirectory synchroniseCache failed synchronisation complete in 571ms

2012-08-24 19:24:44,512 ERROR scheduler_Worker-6 atlassian.crowd.directory.DbCachingDirectoryPoller pollChanges Error occurred while refreshing the cache for directory 1310721 .

org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: com.atlassian.crowd.embedded.hibernate2.HibernateMembership#2163210 ; SQL ; Duplicate entry '917507-2130025' for key 'cwd_unique_user_membership'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '917507-2130025' for key 'cwd_unique_user_membership'

at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:100)

at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)

at org.springframework.orm.hibernate.HibernateTransactionManager.convertJdbcAccessException(HibernateTransactionManager.java:619)

at org.springframework.orm.hibernate.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:605)

at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:518)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

at com.atlassian.crowd.directory.$Proxy1054.addUserToGroup(Unknown Source)

at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.addUserToGroup(DirectoryCacheImplUsingChangeOperations.java:187)

at com.atlassian.crowd.directory.ldap.cache.EventTokenChangedCacheRefresher.synchroniseChanges(EventTokenChangedCacheRefresher.java:115)

at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:611)

at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:63)

at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50)

at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobBean.executeInternal(DirectoryPollerJobBean.java:29)

at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)

at org.quartz.core.JobRunShell.run(JobRunShell.java:199)

at com.atlassian.confluence.schedule.quartz.ConfluenceQuartzThreadPool$1.run(ConfluenceQuartzThreadPool.java:20)

at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)


Answers:
author: Septa Cahyadiputra
body: Hi Paul,

Sometimes this kind of issue is caused by corrupted synchronization cache. The easiest way to solve this issue is to create a new directory in Confluence side that mapped the same configuration as the previously created Crowd directory and disable the previously created directory.

Hope it helps.

Cheers,  
Septa Cahyadiputra


author: Toby Jackson
body: [](https://confluence.atlassian.com/pages/viewpage.action?pageId=321257915)<https://confluence.atlassian.com/pages/viewpage.action?pageId=321257915>

This describes an alternative approach where you simply change the existing settings and let Confluence reindex itself.


Tags: confluence

duplicate

error

key

mysql