Article View: borland.public.jbuilder.java.api
Article #2232LDAP JNDI problems URGENT
From: John Baker
Date: Tue, 01 May 2001 10:47
Date: Tue, 01 May 2001 10:47
62 lines
3478 bytes
3478 bytes
Help!
I am having problems dealing with LDAP responses using JNDI 1.2.2 with the
LDAP SPI.
It seems that the detinguished name is unparsable but as far as I can see
the server output is fine. Any clues how to get around this? Have I done
something wrong or is the LDAP spi unusably buggy?
Please could you also reply in mail as this is an urgent matter for the
project I am working on. If the LDAP spi is unusable I will have to change
direction completely...
Thanks in advance,
John
The experimental code causing problems is this (except I have substituted
hard coded values that were bombing into the code):
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://directory.verisign.com");
InitialLdapContext context_ldap = new InitialLdapContext(env, null);
Attributes match = new BasicAttributes(true);
match.put(new BasicAttribute("cn", "microsoft"));
NamingEnumeration enum = context_ldap.search("", match);
NameParser parser = context_ldap.getNameParser("");
while (enum.hasMore())
{
SearchResult result = (SearchResult)enum.next();
System.out.println("Parsing " + (result.isRelative() ? "[relative]: " :
"[non-relative]: ") + result.getName());
Name name = parser.parse(result.getName());
}
The output is this:
Parsing [relative]: "ou=MS INTERNAL TESTING
ONLY,cn=Microsoft,l=redmond,st=wa,c=US,ou=Digital ID Class 3 - Microsoft
Software Validation v2,ou=\"www.verisign.com/repository/CPS Incorp. by
Ref.,LIAB.LTD(c)96\",ou=VeriSign Commercial Software Publishers
CA,o=\"VeriSign, Inc.\",l=Internet"
javax.naming.InvalidNameException: Invalid name: "ou=MS INTERNAL TESTING
ONLY,cn=Microsoft,l=redmond,st=wa,c=US,ou=Digital ID Class 3 - Microsoft
Software Validation v2,ou=\"www.verisign.com/repository/CPS Incorp. by
Ref.,LIAB.LTD(c)96\",ou=VeriSign Commercial Software Publishers
CA,o=\"VeriSign, Inc.\",l=Internet"
at com.sun.jndi.ldap.LdapName$DnParser.parseAttrType(LdapName.java:478)
at com.sun.jndi.ldap.LdapName$DnParser.parseRdn(LdapName.java:432)
at com.sun.jndi.ldap.LdapName$DnParser.getDn(LdapName.java:400)
at com.sun.jndi.ldap.LdapName.parse(LdapName.java:303)
at com.sun.jndi.ldap.LdapName.<init>(LdapName.java:76)
at com.sun.jndi.ldap.LdapNameParser.parse(LdapNameParser.java:23)
at
com.softcomms.trackomatic.ext.ldap.gui.LDAPViewer$ResultsTableModel.parseRes
ult(LDAPViewer.java:304)
at
com.softcomms.trackomatic.ext.ldap.gui.LDAPViewer$1.run(LDAPViewer.java:240)
at com.softcomms.trackomatic.util.RunQueue.run(RunQueue.java:109)
Technical Details
Message-ID:
<3aee9287_1@dnews>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,1942bf0b49c8fe60,start X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2001-05-01 03:44:03 PST From: "John Baker" <jbaker@SoftComms.com> Newsgroups: borland.public.jbuilder.java.api Subject: LDAP JNDI problems URGENT Date: Tue, 1 May 2001 11:47:19 +0100 Lines: 67 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 213.123.54.36 Message-ID: <3aee9287_1@dnews> X-Trace: dnews 988713607 213.123.54.36 (1 May 2001 03:40:07 -0700) Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews