tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ferrante <>
Subject new InitialDirContext(env); instantiating with invalid user info
Date Thu, 18 Aug 2005 18:23:42 GMT

I've been trying to use the code below to validate a username/ 
password against an LDAP (ActiveDirectory) server

When I use this in a main from the command line with a bad password I  

> Exception in thread "main" javax.naming.AuthenticationException:
[LDAP: error code 49 - 80090308: LdapErr: DSID-0C09030B, comment:  
AcceptSecurityContext error, data 52e, v893]

but when from a servlet in Tomcat,  I proceeds without error.

I googled for answers but couldn't quite find anything that quite  
matches my situation  -- I'm runing Java 5 and Apache Tomcat/5.5.7

I thought it might have to do with realms, so following some  
recommendations I commented out the realm info in the server.xml, but
it didn't have any effect.

Any info/pointers would be appreciated.



    Hashtable env = new Hashtable();
          try {
              env.put(Context.PROVIDER_URL, "ldap://ldapHost:389");
              env.put(Context.SECURITY_AUTHENTICATION, "simple");
              env.put(Context.SECURITY_PRINCIPAL, "" + userId +
              env.put(Context.SECURITY_CREDENTIALS, password);
              env.put(Context.REFERRAL, "follow");
              DirContext ctx = new InitialDirContext(env);

Richard D. Ferrante
Assoc Principal Software Engineer
Millennium Pharmaceuticals
40 Landsdowne St.
Cambridge, Ma. 02139
Phone: 617-679-7466
Fax: 617-577-3555

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message