LDAP响应读取超时,使用的超时时间:-1ms。在java中创建LDAP请求时

LDAP响应读取超时,使用的超时时间:-1ms。在java中创建LDAP请求时,java,active-directory,ldap,Java,Active Directory,Ldap,我试图通过创建InitialDirContext,通过LDAP请求创建到服务器的连接。从去年开始,这个函数工作得很顺利,现在突然出现了一个错误:“LDAP响应读取超时,使用超时:-1ms。” 我已经验证了机器的java版本为“1.8.0_251”,高于1.6,1.7 我还通过添加ldap timeout属性作为properties.put(“com.sun.jndi.ldap.read.timeout”,“30000”)进行了测试,但它并没有解决我的问题 有人能帮我吗 Properties pr

我试图通过创建InitialDirContext,通过LDAP请求创建到服务器的连接。从去年开始,这个函数工作得很顺利,现在突然出现了一个错误:“LDAP响应读取超时,使用超时:-1ms。”

我已经验证了机器的java版本为“1.8.0_251”,高于1.6,1.7

我还通过添加ldap timeout属性作为properties.put(“com.sun.jndi.ldap.read.timeout”,“30000”)进行了测试,但它并没有解决我的问题

有人能帮我吗

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;
        }

问题中,请进行堆栈跟踪。问题发生的原因是云平台的网络问题。现在已经解决了。