Getting "duplicate key: Exchange Domain Servers" error on AD synchronization after upgrage to 3.5
Asked by Sergei Dorogin:

I'm trying to migrate from Confluence 3.1.2 to 3.5.17.

I use AD as user directory. During upgrade Confluence created a user directory with correct settings. (Previously LDAP config was in file). All users and groups were synchronized and I can see them but users have no memberships (groups).

I can see an error in log during synchronyzation (see below).

All LDAP/AD settings are the same as in Stash where everything works fine (users/groups/memberships).

So what does this error mean : "java.lang.IllegalArgumentException: duplicate key: Exchange Domain Servers" ?

How to fix it?

```
2015-06-26 22:29:47,678 ERROR [QuartzScheduler_Worker-1] [atlassian.crowd.directory.DbCachingDirectoryPoller] pollChanges Error occurred while refreshing the cache for directory [ 37257217 ].
```

```
java.lang.IllegalArgumentException: duplicate key: Exchange Domain Servers
```

```
?? ?at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:62)
```

```
?? ?at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:210)
```

```
?? ?at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:196)
```

```
?? ?at com.google.common.collect.Maps.uniqueIndex(Maps.java:456)
```

```
?? ?at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseMemberships(AbstractCacheRefresher.java:126)
```

```
?? ?at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:44)
```

```
?? ?at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.synchroniseAll(UsnChangedCacheRefresher.java:223)
```

```
?? ?at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:619)
```

```
?? ?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:19)
```

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

```
2015-06-26 22:30:00,117 ERROR [QuartzScheduler_Worker-9] [confluence.stats.internals.StatsManagerImpl] processDataQueue Inner SQL Exception: 207 [42S22] - Invalid column name 'sessionID'.
```


Answers:
author: lavitz slambert
body: Strange, I saw that behaviour of losing the group memberships before, when that happened with me the problem I followed the work around of below KB:

<https://confluence.atlassian.com/display/CONFKB/Local+Group+Memberships+for+LDAP+Users+are+Lost+After+Confluence+3.5.x+Upgrade>

![information](/html/@4DF2F60CA30FBCA0CD7B960B5D0F871B/images/emoticons/information.png "information") Yep, I had make sure that the file was copied properly.

What is strange is that invalid error you are facing. Can you try following the work around of below KB and see if that improves the current situation?

What database you are using?

Also, if this is prod, please make sure to backup your database and do this upgrade on a test environment instead.

Lastly, I know the upgrade worked in stash, however that does not means it will work in Confluence as those upgrades from a EOL version are not a "walk in the park". Most people see atlassian apps as sisters however they are more like cousins (they share similarities but in their core they are totally different applications).  
As upgrade cases tend to get complicated I would also suggest you to raise a support case at <https://support.atlassian.com> in case you have some urgency for this task.  
Thanks and Regards,  
Lavitz - the guy that uses Confluence on Windows as a Hobby!

comments: author: Sergei Dorogin
body: The issue you refered is about local group membership - where membership of AD-users in local groups were lost. In my case I lost all users memberships in any group. These membership should be loaded from AD but failing due to the exception I mentioned.


Tags: confluence-administration