LDAP sync fails with InvalidNameException

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Problem

Configuring the LDAP directory incorrectly fails. The following appears in the bitbucket-server.log:

1 2 3 2016-02-03 14:45:47,252 ERROR [http-bio-7990-exec-10] 885x2150x0 1jx2dla 10.1.20.94 "POST /j_stash_security_check HTTP/1.1" c.a.c.directory.ldap.name.SearchDN User Search DN could not be parsed javax.naming.InvalidNameException: Invalid name: (&(objectCategory=Person)(sAMAccountName=*)),dc=auth ...

Diagnosis

The stack trace above means that the values configured for Base DN + Additional User DN are incorrect.

Alternatively, you could look for the following value pairs in the faling External Directory configuration by investigating the Directory Configuration Summary.

For the example we are analysing, the values were:

1 2 ldap.user.dn=(&(objectCategory=Person)(sAMAccountName=*)) ldap.basedn=dc=auth

Which combined result in an invalid search response back from the LDAP server.

Cause

Incorrect configuration for Base DN + Additional User DN.

Solution

Resolution

On that field, what should be configured is anything that is more specific to your tree as it will combine the "Base DN" + "Additional User DN" should not contain a filter format.

That's why Bitbucket is incorrectly was trying to to find the object: (&(objectCategory=Person)(sAMAccountName=*)),dc=auth.

The "User Object Filter:" under the "User Schema Settings" should be the one to contain the How to write LDAP search filters (which should be the one that looks similar to (&(objectCategory=Person)(sAMAccountName=*)).

If your user can be found under the "Base DN:", then you need to specify nothing for the "Additional User DN".

The solution is to configure the "Base DN" + "Additional User DN" correctly.

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.