Hey,
Using Spring-ldap-core:1.3.0-RELEASE as version..
In order to CRUD an Ldap entry I'm using LdapTemplate with DirContextAdapter. Everything works except doing an update operation (U ^^ )
The LDAP entry is a User with a bunch of attributes. The add method looks like this and works fine:
Then the update method. This throws:Code:public void add(User user) { DistinguishedName dn = (DistinguishedName) createDN(user); DirContextAdapter context = new DirContextAdapter(dn); mapUserToContext(user,context); context.setAttributeValues("objectClass",new String[]{ "top","person","organizationalPerson","inetorgperson","inetuser" }); getLdapTemplate().bind(dn,context,null); }
javax.naming.directory.InvalidAttributeValueExcept ion: 'postalAddress' has no values.; remaining name .....
This is weird because it's true that postalAddress is null when I update it, but it's also null when I use the add method. There it doesn't throw an exception.
Code:public void update(User user) { DistinguishedName dn = (DistinguishedName) createDN(user); DirContextAdapter context = (DirContextAdapter) getLdapTemplate().lookup(dn); context.setAttributeValues("objectClass",new String[]{ "top","person","organizationalPerson","inetorgperson","inetuser" }); mapUserToContext(user,context); getLdapTemplate().modifyAttributes(dn,context.getModificationItems()); }
Thanks in advance


Reply With Quote
