Test LDAP connection using standalone Java applicationSummaryOne of the types cases that is frequently assigned to CS-Integrations deal with LDAP connectivity issues. This type of issue occurs when the ServiceNow instance is not able to connect to the customer’s LDAP server. One of the best things a TSE should determine is if this is an issue on the ServiceNow side or the customer’s LDAP server side. The best method to answer this question is to attempt to connect to the customer’s LDAP server using a 3rd party tool from a network outside of ServiceNow. If the test is successful, then the issue is most likely on the ServiceNow side. However, if the test fails, then the issue is most likely on the customer’s side. A popular 3rd party tool that is already installed in all of the ServiceNow servers is ‘ldapsearch’. I am not going to explain how to use the ‘ldapsearch’ tool here, for information on this tool see Knowledge Base article KB0549836 titled ‘Using ldapsearch to test an LDAP server’. If ‘ldapsearch’ is not a valid option, then the customer can also compile and run the following Java application to test their LDAP connection. import java.util.Hashtable;import javax.naming.Context;import javax.naming.NamingException;import javax.naming.ldap.InitialLdapContext;import javax.naming.ldap.LdapContext;public class TestLdapConnection { public static void main(String[] args) { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL,"ldap://10.11.110.110:636"); try { //bind to the domain controller LdapContext ctx = new InitialLdapContext(env,null); ctx = new InitialLdapContext(env, null); System.out.println("LDAP Connection Successful"); System.exit(0); } catch (NamingException e) { System.err.println("LDAP Notifications failure. " + e); System.exit(1); } }}InstructionsUse these instructions to compile and run the application. Note, that I am assuming that the customer already has a JVM installed. copy and paste the code into a file named TestLdapConnection.javaupdate the following line to have it point to their ldap server: env.put(Context.PROVIDER_URL,"ldap://192.168.2.129:636");compile with: javac TestLdapConnection.javarun with: java TestLdapConnection You may also run the application using the -Djavax.net.debug=all to get network debug information.