Solved

Difference between connecting to Active Directory and OpenLDAP

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
V.simple question about Android packages and libraries 1 46
login form jsp example 2 71
ejb entity bean example issue 2 43
Problem to Alipay 10 94
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
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…
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 …
Suggested Courses

734 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