Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Difference between connecting to Active Directory and OpenLDAP

Posted on 2006-11-16
4
Medium Priority
?
669 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

971 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