ldap7找不到属性

将ldap的数据迁移到ldap7中,报下面的错误。数据没有问题,但是一直找不到节点。 

 

2013-06-27 16:08:25,530 INFO [com.ultrapower.dpp.dao.ldap.LDAPBaseDaoImpl] - 转换前查询sql语句:%{uid} = *jiangzhanghong*
2013-06-27 16:08:25,531 INFO [com.ultrapower.dpp.dao.ldap.LDAPBaseDaoImpl] - 转换后查询过滤条件:(&(uid = *jiangzhanghong*)(objectclass=top)(objectclass=person)(objectclass=organizationalPerson)(objectclass=inetOrgPerson)(objectclass=cmcc-abstractPerson)(objectclass=cmcc-authorizations))
2013-06-27 16:08:25,532 INFO [com.ultrapower.dpp.dao.ldap.LDAPBaseDaoImpl] - 获取LDAP连接成功!
javax.naming.directory.InvalidSearchFilterException: invalid attribute description; remaining name 'ou=authorizations,dc=nj,dc=cmcc'
        at com.sun.jndi.ldap.Filter.encodeSimpleFilter(Filter.java:415)
        at com.sun.jndi.ldap.Filter.encodeFilter(Filter.java:126)
        at com.sun.jndi.ldap.Filter.encodeFilterList(Filter.java:713)
        at com.sun.jndi.ldap.Filter.encodeComplexFilter(Filter.java:633)
        at com.sun.jndi.ldap.Filter.encodeFilter(Filter.java:84)
        at com.sun.jndi.ldap.Filter.encodeFilterString(Filter.java:54)
        at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:519)
        at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1965)
        at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1827)
        at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1752)
        at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368)
        at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:338)
        at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:321)
        at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:248)
        at com.ultrapower.dpp.connection.ldap.context.MyLDAPContext.search(MyLDAPContext.java:195)
        at com.ultrapower.dpp.connection.ldap.impl.LdapConnectionImpl.search(LdapConnectionImpl.java:294)
        at com.ultrapower.dpp.dao.ldap.LDAPBaseDaoImpl.search(LDAPBaseDaoImpl.java:1063)
        at com.ultrapower.ams.dao.BaseDAOImpl.pageSearchWithSub(BaseDAOImpl.java:641)
        at com.ultrapower.esp.dao.sysmanage.user.AmsUserDao.pageQueryAuthorization(AmsUserDao.java:40)
        at com.ultrapower.esp.service.sysmanage.user.AmsUserService.pageQueryUser(AmsUserService.java:44)
        at com.ultrapower.esp.action.sysmanage.accountmanage.AmsUserAction.queryInner(AmsUserAction.java:172)
        at com.ultrapower.esp.action.sysmanage.accountmanage.AmsUserAction.pageQuery(AmsUserAction.java:138)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
        at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.ultrapower.esp.common.security.SecurityFilter.doFilter(SecurityFilter.java:77)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.ultrapower.esp.common.SessionCheckFilter.doFilter(SessionCheckFilter.java:185)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.ultrapower.esp.common.security.XSSSecurityFilter.doFilter(XSSSecurityFilter.java:66)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.ultrapower.esp.common.EncodingFilter.doFilter(EncodingFilter.java:73)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
2013-06-27 16:08:25,534 INFO [com.ultrapower.dpp.dao.ldap.LDAPBaseDaoImpl] - 释放LDAP连接!
 
ldap配置成功,节点也正确但是就是找不到属性
ldap版本为7
他会将生成的sql语句%{uid} = *jiangzhanghong* 认为是属性uid空格,所以找不到属性
需要修改ldap的解析 ulrta-dpp.jar中com.ultrapower.dpp.dao.ldap.LDAPBaseDaoImpl中的
 
/**
* 将sql转换为LDAP过滤条件
* @param sql 查询语句
* @return 过滤条件
*/
private String sqlToLdap(String sql) throws DAOException{
Sql2Ldap sql2Ldap = new Sql2Ldap();
String filter = null;
try {
filter = sql2Ldap.convertToLdap(sql, null);
} catch (NamingException e) {
throw new DataTranException("sql转换成filter时出错", e);
}
                //ldap7兼容性问题,去除空格
filter = filter.replaceAll("[ ]*([\\(\\)=])[ ]*", "$1");
return filter;
}

你可能感兴趣的:(LDAP)