Solved

Difference between connecting to Active Directory and OpenLDAP

Posted on 2006-11-16
4
667 Views
Last Modified: 2013-11-24
Hi Experts,

I have a Java servlet throws a NamingException when attempting to create an InitialDirContext with an invalid user/password when authenticating against OpenLDAP.  When I point the same code to Active Directory, it does not throw the NamingException.  What is the difference between OpenLDAP and AD?  Another difference between the two runs is that the it's running on WebLogic for the OpenLDAP and WebSphere for the AD, but I don't think that would cause this difference in results, right?

Below is the method that is giving me grief:

      private DirContext getDirContext (String ldapUser, String password, String ldapURL) throws NamingException {
            // Set up the environment for creating the initial context
            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY,
                        "com.sun.jndi.ldap.LdapCtxFactory");
            env.put(Context.PROVIDER_URL, ldapURL);

            env.put(Context.SECURITY_AUTHENTICATION, "simple");
            env.put(Context.SECURITY_PRINCIPAL, ldapUser);
            env.put(Context.SECURITY_CREDENTIALS, password);
            
            // Create the initial context
            return new InitialDirContext(env);
      }

Any help would be greatly appreciated.  Thank you.
0
Comment
Question by:david_yoshinaga
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17962452
sound to me that you should use different authentication for OpenLDAP
0
 

Author Comment

by:david_yoshinaga
ID: 18054839
I figured it out. . . I was missing these two lines:

            env.put(Context.STATE_FACTORIES, "PersonStateFactory");
            env.put(Context.OBJECT_FACTORIES, "PersonObjectFactory");

Hope someone else can benifit from this!
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 18368403
PAQed with points refunded (500)

DarthMod
Community Support Moderator
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question