You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by David Le Strat <dl...@yahoo.com> on 2005/11/04 06:36:35 UTC
DirContext Search Error
All,
I am working on integration apacheDS with Jetspeed 2.
I can create entries fine, but I am running into issue
with the DirContext search.
I obtain the following context using pretty much the
default apacheds-server.xml
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,
"ldap://localhost:10389/");
env.put(Context.SECURITY_PRINCIPAL,
"uid=admin,ou=system");
env.put(Context.SECURITY_CREDENTIALS, rootPassword);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
ctx = new InitialLdapContext(env, null);
As you can see the default setting uses
com.sun.jndi.ldap.LdapCtxFactory.
I want to run the following search context query:
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
controls.setReturningObjFlag(true);
NamingEnumeration searchResults = ((DirContext)
ctx).search("", "(&(uid=1269495866)
(objectclass=jetspeed-2-user))", controls );
When doing so, I get the following error:
org.apache.jetspeed.security.SecurityException:
javax.naming.NamingException: [LDAP: error code 36 -
failed on search operation]; remaining name ''
org.apache.jetspeed.security.SecurityException: Caused
by: javax.naming.NamingException: [LDAP: error code 36
- failed on search operation]; remaining name ''
at
com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:2964)
at
com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2934)
at
com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2740)
at
com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1811)
at
com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1734)
at
com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368)
at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:328)
at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:313)
at
javax.naming.directory.InitialDirContext.search(InitialDirContext.java:238)
at
org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao.searchByWildcardedUid(AbstractLdapDao.java:275)
at
org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao.lookupByUid(AbstractLdapDao.java:210)
... 13 more
I would appreciate if anyone had any pointer on what I
am missing here.
Thank you.
Regards,
David Le Strat
________________________
David Le Strat
Blogging @ http://dlsthoughts.blogspot.com
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
Re: DirContext Search Error
Posted by Alex Karasulu <ao...@bellsouth.net>.
David Le Strat wrote:
>All,
>
>I am working on integration apacheDS with Jetspeed 2.
>I can create entries fine, but I am running into issue
>with the DirContext search.
>
>I obtain the following context using pretty much the
>default apacheds-server.xml
>
>env.put(Context.INITIAL_CONTEXT_FACTORY,
>"com.sun.jndi.ldap.LdapCtxFactory");
>env.put(Context.PROVIDER_URL,
>"ldap://localhost:10389/");
>env.put(Context.SECURITY_PRINCIPAL,
>"uid=admin,ou=system");
>env.put(Context.SECURITY_CREDENTIALS, rootPassword);
>env.put(Context.SECURITY_AUTHENTICATION, "simple");
>ctx = new InitialLdapContext(env, null);
>
>
>
Ok if you're embedding why are you going through the protocol with the
SUN LDAP Provider to operate on ApacheDS entries? Use the
CoreContextFactory instead that comes with apacheds to get a handle on
it. That way you don't have to waste cycles going through the network
stack.
>As you can see the default setting uses
>com.sun.jndi.ldap.LdapCtxFactory.
>
>I want to run the following search context query:
>
>SearchControls controls = new SearchControls();
>controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
>controls.setReturningObjFlag(true);
>
>NamingEnumeration searchResults = ((DirContext)
>ctx).search("", "(&(uid=1269495866)
>(objectclass=jetspeed-2-user))", controls );
>
>When doing so, I get the following error:
>
>org.apache.jetspeed.security.SecurityException:
>javax.naming.NamingException: [LDAP: error code 36 -
>failed on search operation]; remaining name ''
>
>org.apache.jetspeed.security.SecurityException: Caused
>by: javax.naming.NamingException: [LDAP: error code 36
>- failed on search operation]; remaining name ''
> at
>com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:2964)
> at
>com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2934)
> at
>com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2740)
> at
>com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1811)
> at
>com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1734)
> at
>com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368)
> at
>com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:328)
> at
>com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:313)
> at
>javax.naming.directory.InitialDirContext.search(InitialDirContext.java:238)
> at
>org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao.searchByWildcardedUid(AbstractLdapDao.java:275)
> at
>org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao.lookupByUid(AbstractLdapDao.java:210)
> ... 13 more
>
>
>
David this is internal to the SUN JNDI Provider. I don't have a clue
why it would be failing. I'd try the search on another LDAP server to
see the behavoir. If the response is the same then you have a config
issue with the SUN provider. If not then we can start looking at
ethereal dumps to see what's going on. Might be the SUN provider is
getting an error code it cannot map to a JNDI exception, however it
usually defaults to a general NamingException if that's the case.
Alex