This discussion is archived
1 Reply Latest reply: Nov 29, 2012 5:09 AM by 680357 RSS

[LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSec

680357 Newbie
Currently Being Moderated
I am getting [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1] when executing ctx.search() command of the below source code:

public void authenticateUser() throws AuthenticationException, NamingException {

Hashtable<String, String> props = new Hashtable<String, String>();
String principalName = "dctestuser1" + "@" + "example1.com";
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
props.put("java.naming.provider.url", "dns://");
props.put(Context.REFERRAL, "follow");
props.put(Context.SECURITY_PRINCIPAL, principalName);
props.put(Context.SECURITY_CREDENTIALS, "admin@123");
props.put("com.sun.jndi.ldap.read.timeout", "90000");

try {
final DirContext ctx=LdapCtxFactory.getLdapCtxInstance("ldap://dc01.example1.com" ,props);
SearchControls ctls = new SearchControls();
ctls.setSearchScope(SearchControls.SUBTREE_SCOPE );
String userReturnedAtts[] = {"cn","member"};
ctls.setReturningAttributes(userReturnedAtts);

NamingEnumeration<SearchResult> answer =
ctx.search("DC=example2,DC=org","(&(objectclass=user)(sAMAccountName=dctestuser2)(userPassword=admin@123))",ctls);

boolean bFound = answer.hasMore();
System.out.println(bFound);
return;
} catch (CommunicationException e) {

}
}

Two domains used in this example, example1.com and example2.org exist on separate forests.
This scenario is working fine using the same credentials without any exception when tested with LDP.exe that comes with windows OS.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points