While trying to perform a simple search on InetOrgPersonObjects, via criteria uid=something
I encountered the following error:
org.acegisecurity.ldap.LdapDataAccessException: Failed to fetch user for username: dmadunic; nested exception is org.springframework.ldap.UncategorizedLdapExceptio n: Operation failed; nested exception is javax.naming.NamingException: problem generating object using object factory [Root exception is org.springframework.ldap.BadLdapGrammarException: RDN could not be parsed fully, remaining 'c']; remaining name 'ou=croz,ou=Users'
org.springframework.ldap.UncategorizedLdapExceptio n: Operation failed; nested exception is javax.naming.NamingException: problem generating object using object factory [Root exception is org.springframework.ldap.BadLdapGrammarException: RDN could not be parsed fully, remaining 'c']; remaining name 'ou=croz,ou=Users'
javax.naming.NamingException: problem generating object using object factory. Root exception is org.springframework.ldap.BadLdapGrammarException: RDN could not be parsed fully, remaining 'c'
at org.springframework.ldap.support.LdapEncoder.nameD ecode(LdapEncoder.java:226)
at org.springframework.ldap.support.LdapRdnComponent. <init>(LdapRdnComponent.java:69)
at org.springframework.ldap.support.DnParserImpl.attr ibuteTypeAndValue(DnParserImpl.java:112)
at org.springframework.ldap.support.DnParserImpl.rdn( DnParserImpl.java:62)
at org.springframework.ldap.support.DnParserImpl.dn(D nParserImpl.java:27)
at org.springframework.ldap.support.DistinguishedName .parse(DistinguishedName.java:130)
at org.springframework.ldap.support.DistinguishedName .<init>(DistinguishedName.java:89)
at org.springframework.ldap.support.DirContextAdapter .<init>(DirContextAdapter.java:131)
at org.springframework.ldap.support.DefaultDirObjectF actory.getObjectInstance(DefaultDirObjectFactory.j ava:56)
at javax.naming.spi.DirectoryManager.createObjectFrom Factories(DirectoryManager.java:228)
at javax.naming.spi.DirectoryManager.getObjectInstanc e(DirectoryManager.java:207)
at com.sun.jndi.ldap.LdapSearchEnumeration.createItem (LdapSearchEnumeration.java:118)
at com.sun.jndi.ldap.LdapNamingEnumeration.nextAux(Ld apNamingEnumeration.java:272)
at com.sun.jndi.ldap.LdapNamingEnumeration.nextImpl(L dapNamingEnumeration.java:252)
at com.sun.jndi.ldap.LdapNamingEnumeration.next(LdapN amingEnumeration.java:200)
at org.springframework.ldap.LdapTemplate.search(LdapT emplate.java:271)
at org.springframework.ldap.LdapTemplate.search(LdapT emplate.java:231)
at org.springframework.ldap.LdapTemplate.search(LdapT emplate.java:561)
at org.springframework.ldap.LdapTemplate.search(LdapT emplate.java:475)
at org.springframework.ldap.LdapTemplate.search(LdapT emplate.java:423)
at org.springframework.ldap.LdapTemplate.search(LdapT emplate.java:444)
...
This error occurs only with Ldap entires which have DN with national characters! When search is performed for entry with DN without national characters all goes well!
LdapEncoder should be modified anyway - the nasty regexp in there should be replaced by something faster.