What is the principal you are passing? It has to be the dn without the prefix "dn=" But I have seen this error only when the password is wrong. What's the LDAP server you are using? Also check passing an empty string for password.