Directory syncronization fails due to Unbalanced parenthesis
Symptoms
JIRA is connected to an LDAP and the directory synchronization fails. The following appears in the atlassian-jira.log
:
2013-11-19 14:06:08,507 QuartzScheduler_Worker-2 ERROR ServiceRunner [atlassian.crowd.directory.DbCachingDirectoryPoller] Error occurred while refreshing the cache for directory [ 10000 ].
com.atlassian.crowd.exception.OperationFailedException: java.util.concurrent.ExecutionException: com.atlassian.crowd.exception.OperationFailedException: org.springframework.ldap.InvalidSearchFilterException: Unbalanced parenthesis; nested exception is javax.naming.directory.InvalidSearchFilterException: Unbalanced parenthesis; remaining name 'dc=example,dc=com'
at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.synchroniseAllUsers(UsnChangedCacheRefresher.java:166)
...
Caused by: java.util.concurrent.ExecutionException: com.atlassian.crowd.exception.OperationFailedException: org.springframework.ldap.InvalidSearchFilterException: Unbalanced parenthesis; nested exception is javax.naming.directory.InvalidSearchFilterException: Unbalanced parenthesis; remaining name 'dc=example,dc=com'
Cause
This problem is caused by wrong LDAP filter defined either into the User Object Filter or Group Object Filter of your directory configuration.
Resolution
To solve this problem check your search filter. You can see more details about LDAP filters in this documentation.
One of the most common problems in this configuration is related to the negation element (!). Follow is an example of utilization:
(&(objectCategory=Person)(sAMAccountName=*)(!(description=test)))