0 Replies Latest reply: Jun 14, 2012 6:44 AM by 937672 RSS


      Hi everyone,

      I'm always getting an error when getting a name from my active directory server.

      The error is the following:

      javax.naming.InvalidNameException: Invalid name: "CN=»OGMA Serviço LAN/WAN",cn=Recipients,cn=Users,,dc=intra

      After googling a bit, I found the following information


      As you can see, I tried both with the parser approach and the composite name approach, but the error continues!

      What am I missing?

      I know the problem comes from the quotes and the forward slash, but the solutions that were presented didn't work for me.

      Here's my code that does those operations:
           DirContext ctx = new InitialDirContext( (Hashtable<String,String>) env);
                     NamingEnumeration contentsEnum = ctx.list(usersContainer);
                     String[] attName = {"cn"};
                     while ( contentsEnum.hasNext() )
                          NameClassPair ncp = (NameClassPair) contentsEnum.next();
                          NameParser ldapParser = ctx.getNameParser("");
                          String name = ncp.getName() + "," + usersContainer;
                          Name n = ldapParser.parse(name);

      Edited by: Nuno Miguel Santos on 14/Jun/2012 4:43