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
Solved

Difference between connecting to Active Directory and OpenLDAP

Posted on 2006-11-16
4
664 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jsp insert to database example 2 46
JAVA API design with micro service cloud in mind 1 46
printf performancy 11 69
Eclipse for Java EE development 2 27
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

856 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