Browsing attributes of ldap entries never finds "cn"

Hello,
newbie here testing how JNDI interacts with a Novell NDS eDirectory LDAP server...
I've created a few test users in the directory, all with "cn" attributes. However, when I run a my JNDI test program, it always finds all the attributes except "cn". I was wondering if anyone ran into this problem before or if it may be some sort of ldap server misconfiguration.
I've included the source code to show how it's working...
************ Start of Source code
import java.util.Hashtable;
import java.util.Enumeration;
import javax.naming.*;
import javax.naming.directory.*;
public class GetAttributes {
          public static String INITCTX = "com.sun.jndi.ldap.LdapCtxFactory";
          public static String MY_SERVICE = "ldap://192.168.0.208:389";
          public static String ENTRYDN = "cn=testcn,ou=TESTOU,o=TESTO";
          public static void main (String[] args) {
               try {
                    Hashtable env = new Hashtable(5, 0.75f);
                    env.put(Context.INITIAL_CONTEXT_FACTORY, INITCTX);
                    /* Specify host and port to use for directory service */
                    env.put(Context.PROVIDER_URL, MY_SERVICE);
                    /* get a handle to an Initial DirContext */
                    DirContext ctx = new InitialDirContext(env);
                    BasicAttributes basicAttributes = (BasicAttributes) ctx.getAttributes(ENTRYDN, null);
                    System.out.println(basicAttributes.size());
                    NamingEnumeration ne = basicAttributes.getAll();
                    BasicAttribute basicAttribute = null;
                    while (ne.hasMore()) {
                         basicAttribute = (BasicAttribute) ne.next();
                         System.out.println(basicAttribute.toString());
               catch (Exception e) {
                    System.out.println(e.toString());
************ End of Source code
************ Start of Results
2
objectClass: person, ndsLoginProperties, top
sn: LastNameOfTest
************ End of Results
Thanks.

If you use SearchControls you can specify the attributes you get back. Maybe you should try explicitly returning the cn to see if the entries are being searched correctly.
SearchControls ctls = new SearchControls();
String[] attrs = { "cn" };
ctls.setReturningAttributes(attrs);Then pass the controls when you search:
results = context.search("",filter,ctls);
//where filter is a string that has your search criteria--Nicole                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Access the oparational attribute 'entryUUID' of an ldap entry

    How can I access the oparational attribute 'entryUUID' of an ldap entry? Does someone have a sample code fragment?

    Attributes attribs = initLdapCtx.getAttributes(fullName, new String[]{"+"});
    This is for OpenLDAP only, because it's the only server I know which supports "+" meaning "all Attributes".
    For other Servers you might need to specify the entryUUID Attibute explicitly in the String Array. But be aware that this Attribute might have different Names on different Servers.
    Cheers,
    Peter

  • How to retrieve null-valued attributes from LDAP server.

    I am using JNDI api to do search operations on a Java Directory Server( part of SunOne).
    However, I found all the attributes that do not have values are automatically filtered out from the search result.
                   NamingEnumeration answer = ctx.search(ctxName, filterExpr, cons);
                   while(answer.hasMore()){
                        SearchResult sr = (SearchResult)answer.next();
                        Attributes attrs = sr.getAttributes();
                        for(NamingEnumeration ne = attrs.getIDs();ne.hasMore();){
                             System.out.println("ids:"+ne.next());
                        System.out.println("-------------------------------------------------------");
                       for (NamingEnumeration ae = sr.getAttributes().getAll(); ae.hasMore();) {
                           Attribute attr = (Attribute)ae.next();
                           System.out.println("attrName:"+attr.getID());
                           //System.out.println("attribute: " + attr.getID());
                           NamingEnumeration e = attr.getAll();
                           while(e.hasMore()){
                                 System.out.println("  attrVal:"+e.next());
                       }Is there anything I did wrong here?
    Here are a couple of things I noticed,
    1. in a Softerra LDAP browser, those no-valued attributes are not present either. But in JXplorer, I can see the full list that includes the attributes that do not have a value.
    2. I had Schema disabled in the server console.
    Thank you in advance.

    There are only two ways to read data from Directory Server:
    1. a. just fetch the entry
    b. display the content
    2. a. fetch the entry
    b. parse the entry and figure what object classes it is of
    c. lookup each object class definition in the schema and retrieve the attribute list
    d. combine the attributes of the entry with all the "possible" attributes of its object classe(s)
    e. display the content
    Here's for an easy example we can relate to:
    I have the following entry in my DS
      cn=the_duuuuuude,dc=forum,dc=sun,dc=com
      objectClass: person
      cn: the_duuuuuude
      sn: arnaudIf you use method 1, you will get just what is stored in the db. That is:
      cn=the_duuuuuude,dc=forum,dc=sun,dc=com
      objectClass: person
      cn: the_duuuuuude
      sn: arnaudif you use method 2, you will get:
      cn=the_duuuuuude,dc=forum,dc=sun,dc=com
      objectClass: person
      cn: the_duuuuuude
      sn: arnaud
      description:
      seeAlso:
      telephoneNumber:
      userPassword:because when you looked up the 'person' object class you got this:
    objectClasses: ( 2.5.6.6 NAME 'person' DESC 'Standard LDAP objectclass' SUP top MUST ( sn $ cn ) MAY ( description $ seeAlso $ telephoneNumber $ userPassword ) X-ORIGIN 'RFC 2256' )Now the important thing to note is that physically in the database, the attributes description, seeAlso, telephoneNumber and userPassword are NOT stored. It's not that they have a 'null' value. They're just not there. It doesn't stop you from looking up the schema.
    Optimally, in your client, you would fetch the whole server schema and cache it so you have to do the extra round trip for every entry you process.
    The difference you observe with various LDAP browsers might simply be that one uses method 1 and the other method 2.
    Hope this helps wrap your mind around this.
    -=arnaud=-

  • Convertion of LDAP entries

    We are planning to use iMT to convert our application from
    NetDynamics 5.0 to iPlanet server. I would like to know if there is
    an easy way to convert LDAP entries in Production without changing
    user's password.
    Thanks
    --das
    763-593-7167

    Hi Wilpred,
    As you will have the userID attribute you can do a search on the entryDN attribute (SUN ONE DIRECTORY SERVER - which we have used).
    This attribute is formed using the user Id and not the CN.
    Once you get the entryDN value of the USer entry then you can manipulate any of the values.
    I am not quite sure about any such attribute existing in Active Directory, but you can find that out. For youir convienience a sample user entry for entryDN is:
    entrydn=uid=tstbkr01,ou=people,o=enterpriseis.co.uk
    entrydn=cn=BrokerA,ou=groups,o=enterpriseis.co.uk
    The first entry is for user entries and the second one is for group entries(i.e) tstbkr01 is a user and BrokerA is a group in our system.
    Hope this will help you,
    Regards,
    pradipg

  • User attributes for LDAP

    Hi guys,
    Currently we have an error for LDAP attribute .
    distinguishedName = (String) user.getTransientAttribute("ldap.distinguished_name");
    user is of type IUser.
    and it return null
    where could i find the list of user attributes in LDAP? currently we have LDAP 8.8.1.

    Don,
    you might should have a look at a LDAP Browser (eg. http://www-unix.mcs.anl.gov/~gawor/ldap/ ) which helps a lot to find out how the structure of your LDAP server is and which attributes you can access.
    1) Start the tool
    2) click onto the "Quick Connect"
    3) enter you LDAP server
    4) press "Fetch DNs"
    5) Uncheck "Anonymous bind"
    6) Enter your user credentials
    7) Browse your LDAP structure
    It helped me a lot to get the correct settings for the DBMS_LDAP calls.
    Patrick
    My APEX Blog: http://www.inside-oracle-apex.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://apexplugin.sourceforge.net/ New!

  • DN attribute in ldap

    Hi,
    The Schema reference of Directory Server 5.1 has an attribute called dn which is nothing but the distinguished name of that ldap entry. Is it possible to do a search using this atribute i.e I want to sepicify the search filter as (dn=cn=Test,ou=People,o=myorg)
    I tried and did not return any result.
    Can anyone help me.
    Thanks
    Sudipta

    So if you know the DN - set that as the base (without dn=) and objectclass=* as the filter ...
    Then return the attributes you want ...
    ldapsearch -b "uid=user,ou=users,dc=company,dc=com" -h host -p port -D "binddn" -w password "objectclass=*" attr

  • Need help in retrieving attributes from LDAP using JNDI

    I am trying to retrieve attributes from LDAP using JNDI, but I'm getting the following error when I try to run my Java program.
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/naming/NamingException
    I have all the jar files in my classpath: j2ee.jar, fscontext.jar and providerutil.jar. The interesting thing is that it gets compiled just fine but gives an error at run-time.
    Could anyone tell me why I'm getting this error? Thanks!
    Here's my code:
    import javax.naming.*;
    import javax.naming.directory.*;
    import java.util.*;
    import java.io.*;
    class Getattr {
    public static void main(String[] args) {     
    // Identify service provider to use     
    Hashtable env = new Hashtable(11);     
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");      
    // user     info
    String userName = "username";     
    String password = "password";          
    // LDAP server specific information     
    String host = "ldaphostname";     
    String port = "portnumber";     
    String basedn = "o=organization,c=country";     
    String userdn = "cn=" + userName + "," + basedn;          
    env.put(Context.PROVIDER_URL, "ldap://" + host + ":" + port + "/" + basedn);     
    env.put(Context.SECURITY_PRINCIPAL, userdn);     
    env.put(Context.SECURITY_CREDENTIALS, password);     
    try {          
    System.setErr(new PrintStream(new FileOutputStream(new File("data.txt"))));     
    // Create the initial directory context     
    DirContext ctx = new InitialDirContext(env);          
    // Ask for all attributes of the object      
    Attributes attrs = ctx.getAttributes("cn=" + userName);          
    NamingEnumeration ne = attrs.getAll();                    
    while(ne.hasMore()){                         
    Attribute attr = (Attribute) ne.next();                                   
    if(attr.size() > 1){               
    for(Enumeration e = attr.getAll(); e.hasMoreElements() ;) {                                       
    System.err.println(attr.getID() + ": " + e.nextElement());                     
    } else {
         System.err.println(attr.getID() + ": " + attr.get());
    // Close the context when we're done     
    ctx.close();     
    } catch(javax.naming.NamingException ne) {
         System.err.println("Naming Exception: " + ne);     
    } catch(IOException ioe) {
         System.err.println("IO Exception: " + ioe);     

    That doesn't work either. It seems its not finding the NamingException class in any of the jar files. I don't know why? Any clues?

  • Multi level attribute form LDAP

    multi level attribute form LDAP
    I am trying to write an custom mapping to use to retrieve a value from a multialued field in LDAP (nsRole). Has anyone done this before?
    Rigth now all my mappings are 1:1. However the goal is to get a 1 : M and parse thru it till i get the desied value (1:1)

    Darwin Hammons - Assurant 
    2:44pm, May 17 
    Great conversation. I have a very similar question about the use of the custom JAVA mappings with the LDAP Login process. I want to include an additional (event) step in the login process. Does anyone have an example or experience with a custom Java Class mapping that can use an LDAP attribute (location)  queriing the data to execute an event that populates an RequestCenter OU or Group if the person login location equal say " Argentina" ? Looking for a way to manage / build catalog entitlements during login. Suggestions ?
    Great conversation. I have a very similar question about the use of the custom JAVA mappings with the LDAP Login process. I want to include an additional (event) step in the login process. Does anyone have an example or experience with a custom Java Class mapping that can use an LDAP attribute (location)  queriing the data to execute an event that populates an RequestCenter OU or Group if the person login location equal say " Argentina" ? Looking for a way to manage / build catalog entitlements during login. Suggestions ?
    Anthony Erickson
    2:52pm, May 18  
    Hi Darwin,
    We're about to embark on a piece of work with newScale which would be similar to this to support our Multilingual catalogue.  I'll provide any updates I'm able. 
    Thanks,
    Ant 
    Darwin Hammons - Assurant 
    3:25pm, May 18 
    Great, Thanks Anthony ! I hope our bringing up this topic will spark a bit of interest. The Custom Java Mapping  / Directory integration is documented more with RC 9.1. It will be good to hear more about your project and use of Java mappings with LDAP Directories. 

  • Game center never Find a player

    I Tried to play multiplayer by game center but it wont find any players on the other hand my brother iphone can find players and He can invite hes friends but 4 me i I tried to invite my friends and it says connecting I have waited for 30 mins and never let us play (my friend still can play online etc..) so I tried to restore my ipad i was on ios 7 now I am on ios 8 and I've set my ipad as a new one and still the same problem that was with  doodle jump and I tried other games that support game center online and never find a player ! But I can play online with my facebook but still there are some games only game center support and I wanted to play with my friend so please help me why it wont find a player  or that connecting for ever with my friends when I tried to invite them.

    Hello there.
    The following Knowledge Base article offers up some great pointers and references for troubleshooting login issue for Game Center:
    Using Game Center
    http://support.apple.com/kb/ht4314
    Particularly:
    If you are having difficulty logging in to Game Center or staying connected
    Verify that you are connected to the Internet.
    If you are unable to create or sign in to your Game Center account from within a game, try creating or signing in to your account using the Game Center app.
    Try signing out of your Game Center account, then sign back in. If you can't sign in to your Game Center account with an Apple ID, try resetting your password or using another email address. To manage your Apple ID account, go to My Apple ID.
    When using a Wi-Fi connection, verify that your Wi-Fi router is configured for Game Center.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Accessing custom attributes in LDAP using WD Java - UME APIs

    Hello Friends,
    I am trying to access a custom attribute from LDAP in WebDynpro Java. I am using bellow code.
    IWDClientUser clientUser = WDClientUser.getCurrentUser();
    IUser sapUser = clientUser.getSAPUser();
    if (sapUser != null) {
    String[] str_emp = sapUser.getAttribute(<Name Space>,"Attribute Name");
    if (str_emp == null || str_emp.length == 0) {
    wdComponentAPI.getMessageManager().reportSuccess(" NULL ");
    return;
    } else {
    strEmpID = str_emp[0];
    wdComponentAPI.getMessageManager().reportSuccess(strEmpID);
    The name space is "$usermapping$". I am not sure why it is like that only for this attribute i am trying to access.
    I am getting null value if i run this code.
    Can any one help
    thanks
    Shobhan

    Hi,
    Are you sure this is the right namespace? The default namespace is com.sap.security.core.usermanagement.
    You can get all namespaces and the names of all attributes defined for a user using methods getAttributeNamespaces and getAttributeNames : [Interface IPrincipal|http://help.sap.com/javadocs/NW04S/current/se/index.html].
    Regards,
    Pierre

  • Proximity Never Finds Video System on Windows 7

    I am a Windows 7 user (don't hate).  I excitedly installed Proximity looking forward to using (Cisco Proximity desktop-1.0.0-Alpha17), but it just never finds a Video System.  It just is grayed out and reads: "Looking for video systems...":
    I can't seem to figure it out.  Unfortunately has been useless to me.  I know the TP systems I try work, because other Mac users connect just fine.  :(
    Any ideas?!?

    Here is what I had to do on my Lenovo W530:

  • I hit the wrong entry for find my ipad, I hit the iphone, how do I get it to correct

    I hit the wrong entry for "find my ipad, how do i get it to correct

    You can log out of the currently logged in account by tapping on it in Settings > Store, and you should then be able to log in with the account that you want.

  • Trying to sync with desktop (Local PC), searches but never finds connected PC

    trying to sync with desktop (Local PC), searches but never finds connected PC. How to manually sync?

    1. Uninstall your Blackberry Desktop Software
    2. Restart your computer
    3. Install new Blackberry Desktop Software to the different location
    try to run  Blackberry Desktop Software and connect it to your device

  • Hi I think its not a good idea to have "airplane mode" in Control center because if you lost your iphone person who find it could active it easy and you never find it

    Hi I think its not a good idea to have "airplane mode" in Control center because if you lost your iphone person who find it could active it easy and you never find it

    You can leave Apple your feedback here.
    You can disable Control Center on the lock screen here:
    Settings > Control Center

  • Updating attributes in LDAP during a disable

    I am having trouble with a disable workflow for an LDAP resource. I need to modify an attribute in LDAP when performing the disable.
    So, I have a modified disable user form that adds a "reason" from a textbox and also sets the date of the disble.
    The account is being disabled in LDAP, but the attributes "reason" and "date" are not being pushed.
    I am looking for the specific order in which I should call workflow to accomplish this task.
    Should I:
    checkout a userview
    modifiy attributes
    checkin userview
    checkout disable view
    checkin disable view
    reprovision???
    notification
    Thanks for your help in advance.
    C.

    The reason they aren't being pushed is because they are not attributes associated with the Disable View.
    You can extend the view to include these attributes and then the disable form can include reference these as fields as
    resourceAccounts.currentResourceAccounts[ResourceTypeName].attribute.
    The view can be extended globally for all all resources of a specified type (e.g. LDAP 1, LDAP2) or for a specific resource.
    The Deployment Guide has a chapter on Views and how to extend them. Refer there first, and if you have any followup questions post them here.

Maybe you are looking for

  • IPhone Home screen icons

    When I create a home screen icon most of them place a custom icon on the home screen, usually with the websites logo. But a few of them just place an icon with a shot of the whole page. Is there a way to request or create a custom home icon from a si

  • How to create work order in a manufacturing system

    Hi, I am using EBS 11i. I have applied APS pack on it. I want to create a work order. Can anyone brief me on which responsibility to choose in order to create a work order. Also if someone can suggest some documents will be of great help. Thank You,

  • Font issue witth PDF report

    Hi, I have a requirement to Print the Company name in GE Inspira font. I have installed the GE Inspira font in my local machine. Then in my template I selected the same font ,but PDF output it is showing Arial Font. Could any body please tell me the

  • Windows won't load or install, K7N2G

    Running an AMD Athlon XP 2500+ on a K7N2G, just got it. Won't load windows or install from the CD, usually it either locks up or bluescreens, other times it will make it into the install/repair process before it crashes. Using Corsaire CMX512-3200C2P

  • Is delta certification different than a full certification?

    Hello experts, I recently became certified on BW 3.5 and want to become certified on BI 7.0. I understand I can take the delta exam (40 questions) instead of the full BI 7.0 (80 questions). Do both certificatins (delta and full) have the same value?