title: Keycloak cannot connect to LDAP
body: <p>I'm trying to connect my keyclak (docker-based) installation to LDAP. To test ldap, I logged into docker container and issued the following query:</p>
  
  <p><code>ldapwhoami -vvv -h ldap.domain.com -p 389 -D ldap_srv_user -x -w password</code></p>
  
  <p>Which successfully returned a success with:</p>
  
  <p><code>
  ldap_initialize( ldap://ldap.domain.com:389 )
  u:GLB\ldap_srv_user
  Result: Success (0)
  </code></p>
  
  <p>However, when I enter same connect url (<code>ldap://ldap.domain.com:389</code>) in keycloak LDAP federation config I get a connection refused with the following stacktrace:</p>
  
  <blockquote>
    <p>11:27:15,578 ERROR [org.keycloak.services] (default task-39)
    KC-SERVICES0055: Error when connecting to LDAP:
    ldap.domain.com:389: javax.naming.CommunicationException:
    ldap.domain.com:389 [Root exception is java.net.ConnectException:
    Connection refused (Connection refused)]  at
    com.sun.jndi.ldap.Connection.(Connection.java:226)  at
    com.sun.jndi.ldap.LdapClient.(LdapClient.java:137)  at
    com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1615)    at
    com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2749)  at
    com.sun.jndi.ldap.LdapCtx.(LdapCtx.java:319)    at
    com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:192)
      at
    com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:210)
      at
    .....</p>
  </blockquote>
  
  <p>Did anyone also had this issue? What could be the reason?</p>