lumpynose
Aug 29th, 2006, 05:11 PM
I'm using a ContextMapper with search() and in it I have a println for debugging. After being called 9 times (it prints 9 lines) it bombs with a BadLdapGrammarException.
Is it possible that the cn value it's complaining about is malformed because it has a slash in it? All of the previous ones which it prints out don't have a slash in them.
private class
AffilsContextMapper implements ContextMapper {
public Object
mapFromContext(final Object context) {
final DirContextAdapter ctx = (DirContextAdapter) context;
System.out.println("ctx: " + ctx);
final String affil = ctx.getStringAttribute(attrNameAffilsName);
return(affil);
}
}
Operation failed; nested exception is javax.naming.NamingException: problem generating object using object factory [Root exception is net.sf.ldaptemplate.BadLdapGrammarException: Not a proper name (such as key=value): "cn=LBL/DOE Postdoc]; remaining name 'ou=affiliations'
net.sf.ldaptemplate.UncategorizedLdapException: Operation failed; nested exception is javax.naming.NamingException: problem generating object using object factory [Root exception is net.sf.ldaptemplate.BadLdapGrammarException: Not a proper name (such as key=value): "cn=LBL/DOE Postdoc]; remaining name 'ou=affiliations'
Caused by: javax.naming.NamingException: problem generating object using object factory [Root exception is net.sf.ldaptemplate.BadLdapGrammarException: Not a proper name (such as key=value): "cn=LBL/DOE Postdoc]; remaining name 'ou=affiliations'
at com.sun.jndi.ldap.LdapSearchEnumeration.createItem (LdapSearchEnumeration.java:111)
at com.sun.jndi.ldap.LdapNamingEnumeration.nextAux(Ld apNamingEnumeration.java:256)
at com.sun.jndi.ldap.LdapNamingEnumeration.nextImpl(L dapNamingEnumeration.java:236)
at com.sun.jndi.ldap.LdapNamingEnumeration.next(LdapN amingEnumeration.java:184)
at net.sf.ldaptemplate.LdapTemplate.search(LdapTempla te.java:201)
at net.sf.ldaptemplate.LdapTemplate.search(LdapTempla te.java:167)
at net.sf.ldaptemplate.LdapTemplate.search(LdapTempla te.java:355)
at net.sf.ldaptemplate.LdapTemplate.search(LdapTempla te.java:293)
at net.sf.ldaptemplate.LdapTemplate.search(LdapTempla te.java:315)
at waitlistd.ldap.LdapAffiliationsImpl.getAffiliation s(LdapAffiliationsImpl.java:36)
at test.Ldap3Test.testGetAffiliations(Ldap3Test.java: 18)
at org.springframework.test.ConditionalTestCase.runBa re(ConditionalTestCase.java:69)
Caused by: net.sf.ldaptemplate.BadLdapGrammarException: Not a proper name (such as key=value): "cn=LBL/DOE Postdoc
at net.sf.ldaptemplate.support.LdapRdn.parseLdap(Ldap Rdn.java:118)
at net.sf.ldaptemplate.support.LdapRdn.<init>(LdapRdn.java:64)
at net.sf.ldaptemplate.support.DistinguishedName.pars e(DistinguishedName.java:133)
at net.sf.ldaptemplate.support.DistinguishedName.<init>(DistinguishedName.java:89)
at net.sf.ldaptemplate.support.DefaultDirObjectFactor y.stripBasePath(DefaultDirObjectFactory.java:90)
at net.sf.ldaptemplate.support.DefaultDirObjectFactor y.getObjectInstance(DefaultDirObjectFactory.java:5 4)
at javax.naming.spi.DirectoryManager.createObjectFrom Factories(DirectoryManager.java:218)
at javax.naming.spi.DirectoryManager.getObjectInstanc e(DirectoryManager.java:197)
at com.sun.jndi.ldap.LdapSearchEnumeration.createItem (LdapSearchEnumeration.java:105)
Is it possible that the cn value it's complaining about is malformed because it has a slash in it? All of the previous ones which it prints out don't have a slash in them.
private class
AffilsContextMapper implements ContextMapper {
public Object
mapFromContext(final Object context) {
final DirContextAdapter ctx = (DirContextAdapter) context;
System.out.println("ctx: " + ctx);
final String affil = ctx.getStringAttribute(attrNameAffilsName);
return(affil);
}
}
Operation failed; nested exception is javax.naming.NamingException: problem generating object using object factory [Root exception is net.sf.ldaptemplate.BadLdapGrammarException: Not a proper name (such as key=value): "cn=LBL/DOE Postdoc]; remaining name 'ou=affiliations'
net.sf.ldaptemplate.UncategorizedLdapException: Operation failed; nested exception is javax.naming.NamingException: problem generating object using object factory [Root exception is net.sf.ldaptemplate.BadLdapGrammarException: Not a proper name (such as key=value): "cn=LBL/DOE Postdoc]; remaining name 'ou=affiliations'
Caused by: javax.naming.NamingException: problem generating object using object factory [Root exception is net.sf.ldaptemplate.BadLdapGrammarException: Not a proper name (such as key=value): "cn=LBL/DOE Postdoc]; remaining name 'ou=affiliations'
at com.sun.jndi.ldap.LdapSearchEnumeration.createItem (LdapSearchEnumeration.java:111)
at com.sun.jndi.ldap.LdapNamingEnumeration.nextAux(Ld apNamingEnumeration.java:256)
at com.sun.jndi.ldap.LdapNamingEnumeration.nextImpl(L dapNamingEnumeration.java:236)
at com.sun.jndi.ldap.LdapNamingEnumeration.next(LdapN amingEnumeration.java:184)
at net.sf.ldaptemplate.LdapTemplate.search(LdapTempla te.java:201)
at net.sf.ldaptemplate.LdapTemplate.search(LdapTempla te.java:167)
at net.sf.ldaptemplate.LdapTemplate.search(LdapTempla te.java:355)
at net.sf.ldaptemplate.LdapTemplate.search(LdapTempla te.java:293)
at net.sf.ldaptemplate.LdapTemplate.search(LdapTempla te.java:315)
at waitlistd.ldap.LdapAffiliationsImpl.getAffiliation s(LdapAffiliationsImpl.java:36)
at test.Ldap3Test.testGetAffiliations(Ldap3Test.java: 18)
at org.springframework.test.ConditionalTestCase.runBa re(ConditionalTestCase.java:69)
Caused by: net.sf.ldaptemplate.BadLdapGrammarException: Not a proper name (such as key=value): "cn=LBL/DOE Postdoc
at net.sf.ldaptemplate.support.LdapRdn.parseLdap(Ldap Rdn.java:118)
at net.sf.ldaptemplate.support.LdapRdn.<init>(LdapRdn.java:64)
at net.sf.ldaptemplate.support.DistinguishedName.pars e(DistinguishedName.java:133)
at net.sf.ldaptemplate.support.DistinguishedName.<init>(DistinguishedName.java:89)
at net.sf.ldaptemplate.support.DefaultDirObjectFactor y.stripBasePath(DefaultDirObjectFactory.java:90)
at net.sf.ldaptemplate.support.DefaultDirObjectFactor y.getObjectInstance(DefaultDirObjectFactory.java:5 4)
at javax.naming.spi.DirectoryManager.createObjectFrom Factories(DirectoryManager.java:218)
at javax.naming.spi.DirectoryManager.getObjectInstanc e(DirectoryManager.java:197)
at com.sun.jndi.ldap.LdapSearchEnumeration.createItem (LdapSearchEnumeration.java:105)