Using LDAP in Java GWT, working on localhost but not on the server -> errorcode 34 -
i'm making application java gwt ldap used retrieve bunch of data. working fine on localhost, once upload everyting our server, ldap keeps giving me errorcode 34. i've done research, , it's invalidnameexception. looking @ loggs, this;
ldap: error code 34 - 0000208f: nameerr: dsid-031001f7, problem 2006 (bad_name), data 8350, best match of: 'ldap:,ou=fmp-fbz'
so apparently not giving valid name. strange becuase on localhost works fine!
edit: notice there comma (,) right after 'ldap: in codeline above, i'm guessing might cause, mean somehow somewhere piece of code gets removed or altered on server....
this method retrieving data;
private final string provider_url = "ldap://xxx/ou=fmp-fbz users, dc=xxx ,dc=xxx, dc=xxx"; private final string provider_url_vdi = "ldap://xxx/ou=fmp-fbz users vdi, dc= xxx, dc=xxx, dc=xxx"; dircontext ctx = null; namingenumeration results = null; hashset<string> ldaploginnames = new hashset<string>(); provider_urls.add(provider_url); provider_urls.add(provider_url_vdi); (string url : provider_urls) { try { hashtable env = new hashtable(); env.put(context.initial_context_factory, "com.sun.jndi.ldap.ldapctxfactory"); env.put(context.provider_url, url); env.put(context.security_authentication, "simple"); env.put(context.security_principal, "cn=xxx,cn=xxx,dc=xxx,dc=xxx,dc=xxx"); env.put(context.security_credentials, "xxx"); ctx = new initialdircontext(env); searchcontrols controls = new searchcontrols(); controls.setsearchscope(searchcontrols.subtree_scope); results = ctx.search(provider_url, "(objectclass=person)", controls); while (results.hasmore()) { searchresult searchresult = (searchresult) results.next(); attributes attributes = searchresult.getattributes(); if(attributes.get("mail")!= null) { ldaploginnames.add(attributes.get("name").get().tostring()); } } } catch (namingexception e) { system.out.print(e.getmessage()); } { if (results != null) { try { results.close(); } catch (exception e) { } } if (ctx != null) { try { ctx.close(); } catch (exception e) { } } } } return new arraylist<string>(ldaploginnames);
as can see, using 2 urls, causing trouble? if point me in right direction, great! thnx in advance!
are looking @ same ldap locally server? might have trim() , clean characters comma mention but, yes, it's curious why wouldn't matter locally.
Comments
Post a Comment