views:

380

answers:

1

Hello,

I'm trying to get an LDAP-Connection with the attributes provided by a glassfish custom-resource.

My jndi settings:

Resourcetype: javax.naming.directory.Directory
Factory-Class: com.sun.jndi.ldap.LdapCtxFactory

Parameters:
java.naming.security.credentials = myPassword
java.naming.security.principal = cn=ldapUser,ou=myOrganization,dc=myDomain,dc=net
URL = ldap://ldapserver/ou=myOrganization,dc=myDomain,dc=net

This is how I get the connection in Java:

Context initCtx = new InitialContext();
DirContext ctx = (DirContext) initCtx.lookup("CMDB2LDAP");

This works perfectly with OpenLDAP but when I try to connect to an AD 2003 I get the following Exception:

javax.naming.NamingException: [LDAP: error code 1 - 00000000: LdapErr: DSID-0C090627, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece]; remaining name ''

When I create my own DirContext and put exactly the same properties in it, the connection works flawlessly.

I would prefer to get the connection settings from glassfish for the sake of easy administration.

A: 

Try adding java.naming.referral = follow as another attribute and see if that works.

Santhana