Month: March 2017
-
UnboundID: The entry contains attribute ‘XXXX’ which is not defined in the schema
PROBLEM Let’s assume we have the following LDIF file containing custom attribute(s), such as managedBy:- When running the code on UnboundID’s In-Memory Directory Server, the following exception is thrown:- SOLUTION The problem is caused by the fact that the default schema does not match Microsoft’s Active Directory schema. Hence, attribute(s), such as managedBy, would cause… Read More…
-
LdapTemplate: javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name ‘…’
BACKGROUND Let’s assume we have the following LDAP configuration… When running any LDAP query, the following exception is thrown:- SOLUTION There are 3 solutions to this problem. Query against Gobal Catalog To prevent the referral issues when dealing with Active Directory, we may query against the Global Catalog by using port 3268. The possible downside… Read More…
-
LdapTemplate: AttributesMapper vs ContextMapper
BACKGROUND When using Spring’s LdapTemplate, there are two ways to transform the queried results: AttributesMapper and ContextMapper. Here’s the comparison between these mapper classes. AttributesMapper If you are migrating your existing LDAP queries to Spring’s LdapTemplate, AttributesMapper seems ideal because you can copy most of the code over because it provides javax.naming.directory.Attributes. However, you have… Read More…
-
Spring: Component Scan Selected Classes
PROBLEM Let’s assume we have a package with the following classes where each class is either annotated with Spring’s @Service, @Component, @Controller or @Repository. When writing unit test, we want Spring to component scan class A and class B. SOLUTION Before we begin, we configure Log4j to log Spring in debug level. Step 1 If… Read More…
-
JAXB2: Adding toString() to Generated Java Classes
PROBLEM By default, the generated Java class prints the memory address when toString() is invoked. However, sometimes it is helpful to have a more meaningful toString() for debugging purposes. SOLUTION To fix this, configure maven-jaxb2-plugin to generate toString() based on the fields in the class:- Read More…