Hello,

I have a problem getting the Connection to a Microsoft ADAM 2008 in Java. I'm getting the following Exception:

javax.naming.AuthenticationException: [LDAP: error code 49 - 8009030C: LdapErr: DSID-0C0904D0, comment: AcceptSecurityContext error, data 52e, v1db0]

The exception indicates I'm using the wrong credentials, but they work using Softerra LDAP Browser. I use a domain-User for Authenticating. The code:

Code:
final String URL = "ldap://HOST:389/";
final String PRINCIPAL1 = "user";
final String PRINCIPAL2 = "domain\\user";
final String PRINCIPAL3 = "user@domain";
final String PASSWORD = "PassWith#";
final String AUTHMETHOD = SecurityAuthenticationMethod.DigestMd5;

DirContext ctx = null;
try {
Hashtable<String, String> ldapEnv = new Hashtable<String, String>(); ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); ldapEnv.put(Context.PROVIDER_URL,URL); ldapEnv.put(Context.SECURITY_AUTHENTICATION,AUTHMETHOD); ldapEnv.put(Context.SECURITY_PRINCIPAL, PRINCIPAL); ldapEnv.put(Context.SECURITY_CREDENTIALS, PASSWORD); ctx = new InitialDirContext(ldapEnv);
I tried every version of the principal. My guess is that the '#' within the password might be a problem. But our password policy requires a special character in the password.

Any ideas?