'Java: Connect to Active Directory via serverless binding?

I have to write some code in Java (technically Groovy, but Java is more common) that will connect to Active Directory and find which groups a user belongs to. I've been looking at various LDAP libraries to accomplish this, however, I'm getting stuck right at the beginning. How can I connect to Active Directory in Java using serverless binding? The serverless binding part is where I'm getting stuck. It seems all the libraries I've tried so far require an actual server hostname and port number. I'd like to avoid having to code these and instead take advantage of the whole serverless binding feature of Active Directory. Is this possible? If so, any pointers to how to do this will be highly appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source