LDAP response read timed out, timeout used:-1ms. in java while creating a LDAP request

Viewed 3385

I am trying to create a connection to server by LDAP request by creating a InitialDirContext. This function was working smoothly from last one year and now suddenly i am getting an error " LDAP response read timed out, timeout used:-1ms."

I have verified the java version of machine as "1.8.0_251" which is above 1.6,1.7.

Also i have tested by adding the ldap timeout property as properties.put("com.sun.jndi.ldap.read.timeout", "30000") but it didn't solve my problem.

Can someone help me on this.

Properties properties = new Properties();
            if (destination != null) {
                properties.putAll(destination.getAllProperties());
                properties.put(Context.SECURITY_AUTHENTICATION, props.getProperty(String.format("%s_LDAP_AUTH_MODE", this.environmentName)));
                properties.put(Context.SECURITY_PRINCIPAL, props.getProperty(String.format("%s_LDAP_BIND_ACCOUNT", this.environmentName)));
                properties.put(Context.SECURITY_CREDENTIALS,new String(SecurePasswordStorage.getPassword(props.getProperty(String.format("%s_LDAP_PASSWORD_ALISA", this.environmentName)))));

                try {
                    context = new InitialDirContext(properties);
                } catch (NamingException e) {
                    LOGGER.error(
                            "unable to initialize directory service, please check bind account info and connection to LDAP {}",
                            e);
                    return false;
                }
            } else {
                LOGGER.error("JDNI destination is not defined");
                return false;
            }
            return true;
        } catch (Exception e) {
            LOGGER.error("Exception while initDirContext: ", e);
            return false;
        }
0 Answers
Related