通过java访问AD时出现即时时间限制错误的原因

通过java访问AD时出现即时时间限制错误的原因,java,active-directory,ldap,cas,spring-ldap,Java,Active Directory,Ldap,Cas,Spring Ldap,我正在尝试查找CAS的一个问题,该问题导致引发以下异常: javax.naming.TimeLimitExceededException: [LDAP: error code 3 - Timelimit Exceeded]; remaining name '' at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3097) at com.sun.jndi.ldap.LdapCtx.processReturn

我正在尝试查找CAS的一个问题,该问题导致引发以下异常:

javax.naming.TimeLimitExceededException: [LDAP: error code 3 - Timelimit Exceeded]; remaining name ''
        at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3097)
        at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2987)
        at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2794)
        at com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch(LdapNamingEnumeration.java:129)
        at com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreImpl(LdapNamingEnumeration.java:198)
        at com.sun.jndi.ldap.LdapNamingEnumeration.hasMore(LdapNamingEnumeration.java:171)
        at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:295)
        at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:361)...
错误几乎立即返回。客户端超时设置为10秒,但没有发生,因为通过查看com.sun.jndi.ldap代码,域控制器似乎正在返回一个状态为3的响应,表示超出了时间限制

我们正在访问一个Active Directory全局目录,并且我们的筛选器和基非常广泛:base='',filter=(proxyAddresses=*:someone@somewhere.com) 但是,查询有时会成功,但会返回立即状态代码3


有人知道是什么导致了这种行为吗?或者可能是如何确定到底发生了什么?

结果是我们的搜索过滤器太宽了

如您所见,我们在过滤器中使用了一个通配符,查询只花了不到2秒的时间

但是,2秒远短于Active Directory配置的时间限制,因此我无法找出错误立即发生的原因(失败时甚至不需要2秒)

我假设AD一定是在累积来自同一帐户的多个请求所花费的时间,并且在某个点上开始返回超出时间限制的错误


为了解决这个问题,我们修改了搜索过滤器,使其不再包含通配符。然后,搜索几乎在瞬间运行,超出时间限制的情况不再发生。

结果表明我们的搜索筛选器太宽

如您所见,我们在过滤器中使用了一个通配符,查询只花了不到2秒的时间

但是,2秒远短于Active Directory配置的时间限制,因此我无法找出错误立即发生的原因(失败时甚至不需要2秒)

我假设AD一定是在累积来自同一帐户的多个请求所花费的时间,并且在某个点上开始返回超出时间限制的错误

为了解决这个问题,我们修改了搜索过滤器,使其不再包含通配符。然后,搜索几乎在瞬间运行,超出时间限制的情况不再发生