javax.naming.NameNotFoundException: ldapDirectory

Issue

When you try to synchronize users from LDAP, you get an error in your instance log similar to the following:

com.day.cq.contentbus.ContentBusException: javax.naming.NameNotFoundException: ldapDirectory at com.day.cq.contentbus.importer.ldap.UserSynchronization.initDataSource(UserSynchronization.java:246) at com.day.cq.contentbus.importer.ldap.UserSynchronization.doInit(UserSynchronization.java:171) at com.day.cq.contentbus.importer.AbstractDriverSynchronization.init(AbstractDriverSynchronization.java:84) at com.day.cq.contentbus.importer.ldap.UserSynchronization.<init>(UserSynchronization.java:158) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at com.day.mozilla.javascript.NativeJavaClass.constructSpecific(Unknown Source) at com.day.mozilla.javascript.NativeJavaClass.construct(Unknown Source) at com.day.mozilla.javascript.ScriptRuntime.newObject(Unknown Source) at libs.LDAPTools.templates.ldapUserSynchronization.action.call(/libs/LDAPTools/templates/ldapUserSynchronization/action.esp:45) at com.day.cq.ecma.EcmaExecuter.callScript(EcmaExecuter.java:2414) at com.day.cq.ecma.EcmaExecuter.processSource(EcmaExecuter.java:626) at com.day.cq.ecma.host.Render.jsFunction_importFile(Render.java:288)

Solution

Make sure that your LDAP server is reachable from CQ.

Additional information

This error can occur when CQ cannot get a connection to your LDAP server.