public LdapContext getContext() throws NamingException {
        try {
            return getContext(baseDN);
        }
        catch (NamingException e) {
            if (alternateBaseDN != null) {
                return getContext(alternateBaseDN);
            } else {
                throw(e);
            }
        }
    }
Returns a DirContext for the LDAP server that can be used to perform
lookups and searches using the default base DN. The alternate DN will be used
in case there is a {@link NamingException} using base DN. The context uses the
admin login that is defined by {@code adminDN} and {@code adminPassword}.

@return a connection to the LDAP server.
@throws NamingException if there is an error making the LDAP connection.
xmppserver/src/main/java/org/jivesoftware/openfire/ldap/LdapManager.java