AcceptSecurityContext error

Hello,

i have use this code to connect ot active directory, but i get

the following execption:

java.naming.AuthonticationException:[LDAP:error code 49-80090308:

LdapErr:DSID-0c090290,comment: AcceptSecurityPolicy error........

the code is:

Hashtable env = new Hashtable();

env.put(Context.SECURITY_AUTHENTICATION,"simple");

env.put(Context.INITIAL_CONTEXT_FACTORY,

"com.sun.jndi.ldap.LdapCtxFactory");

env.put(Context.PROVIDER_URL,"ldap://localhost:389/dc=chatting,dc=iugaza,dc=edu");

env.put(Context.SECURITY_PRINCIPAL,user);

env.put(Context.SECURITY_CREDENTIALS,password);

try{

DirContext ctx = new InitialDirContext(env);

ctx.close();

}catch(Exception e){

e.printStackTrace();

}

what is the problem ?

please help me.

thanks

[867 byte] By [Mhmh] at [2007-9-27 13:55:00]
# 1
Hello,You should add '@domain.name' to your principal name. For example, if account name is 'billgates' and domain name is 'microsoft.com', you principal name will be 'billgates@microsoft.com'.Hope this helps.
sbatiuk at 2007-7-5 21:44:11 > top of Java-index,Core,Core APIs...
# 2

Hi all!

I have the same problem, and I tried to add the domainname, but this also doesnt磘 work. Because there are several people here with this problem I wonder if there is someone who can solve this problem?

If I use the LDAPbrowser to access the Active Directory Server everything works fine!

fishdepp at 2007-7-5 21:44:11 > top of Java-index,Core,Core APIs...
# 3

OK!

I think I found a solution for this Error. Seems to be a BUG in a protocol Win 2000! With service pack 2 or 3 it works! :-o

They(MS) wrote that you maybe could not connect to the ADS with SUN because, SP1 could not handle organisational and pure date in one packeage... what ever this mean...

Another thing is, that ADS needs the principal in this way

env.put( Context.SECURITY_PRINCIPAL, "xxx0034z@belgium.fhm.de" );

not like IPlanet

env.put( Context.SECURITY_PRINCIPAL, "uid=THEUSER, ou=People o=domain.com" );

now it works fine

fishdepp at 2007-7-5 21:44:11 > top of Java-index,Core,Core APIs...
# 4
Maybe try this link:Java Technology Forums - LDAP: error code 49 http://forum.java.sun.com/thread.jspa?messageID=4227692
Dave360 at 2007-7-5 21:44:11 > top of Java-index,Core,Core APIs...