0

I'm trying to connect to apacheds using TLS but I got a LdapOperationException:

PROTOCOL_ERROR: The server will disconnect!

Here is my code:

LdapNetworkConnection connection = null;
    LdapConnectionConfig ldapConnectionConfig = new LdapConnectionConfig();
    ldapConnectionConfig.setUseTls(true);
    ldapConnectionConfig.setLdapHost("localhost");
    ldapConnectionConfig.setLdapPort(10636);
    ldapConnectionConfig.setTrustManagers(new X509TrustManager(){
          public X509Certificate[] getAcceptedIssuers(){
              return new X509Certificate[0];
          }
          public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException{}
          public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException{}
    });

    connection = new LdapNetworkConnection(ldapConnectionConfig);
    connection.connect();

    try{
        connection.startTls();
    }catch(LdapException e){
        e.printStackTrace();
    }

what can be the problem ?

Paolo
  • 20,112
  • 21
  • 72
  • 113
Anass Boukalane
  • 539
  • 10
  • 26

1 Answers1

1

Use port 10389, 10636 is for LDAPS connections.

kayyagari
  • 1,882
  • 13
  • 10