I am using JNDI to connect to the LDAP active directory, and I want to search for users where the name contains the search string, so my search method is as follows:
Solution was to change ldapEnv.put(Context.REFERRAL, "follow"); to ldapEnv.put(Context.REFERRAL, "ignore");
ldapEnv.put(Context.REFERRAL, "follow");
ldapEnv.put(Context.REFERRAL, "ignore");