You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by rburdet <ro...@semperti.com> on 2016/03/28 18:37:30 UTC

Ldap query exception

Hi, im working on an application that needs to make a query to a ldap server.

My bean is :
  	<bean id="ldapserver" class="javax.naming.directory.InitialDirContext"
scope="prototype">
	    <argument>
	        <props>
	            <prop key="java.naming.factory.initial"
value="com.sun.jndi.ldap.LdapCtxFactory"/>
	            <prop key="java.naming.provider.url" value="${LDAP_URL}"/>
	            <prop key="java.naming.security.authentication"
value="${LDAP_AUTHENTICATION}" />
 				<prop key="java.naming.security.principal" value="${LDAP_PRINCIPAL}"/>
                <prop key="java.naming.security.credentials"
value="${LDAP_CREDENTIALS}"/>
                <prop key="java.naming.referral" value="follow"/>	        
            </props>
        </argument>
   	</bean>    

The query im trying to achieve is: 
		String queryLdap =
"(&(objectClass=user)(sAMAccountName="+userName+")(memberOf="+OU+"))";

My ldap component in camel route : 
 <to uri="ldap:ldapserver?base=[[BASE_DN]]"/>

And the stacktrace of the exception is at the bottom.

I cannot find any clues to this issue. 
Any help is appreciated.


Stacktrace:
---------------------------------------------------------------------------------------------------------------------------------------
javax.naming.PartialResultException [Root exception is
javax.naming.NotContextException: Cannot create context for:
ldap://DomainDnsZones.swm.com.ar/DC=DomainDnsZones,DC=swm,DC=com,DC=ar;
remaining name 'DC=swm,DC=com,DC=ar']
	at
com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreImpl(LdapNamingEnumeration.java:242)[:1.7.0_71]
	at
com.sun.jndi.ldap.LdapNamingEnumeration.hasMore(LdapNamingEnumeration.java:189)[:1.7.0_71]
	at
org.apache.camel.component.ldap.LdapProducer.simpleSearch(LdapProducer.java:101)[857:org.apache.camel.camel-ldap:2.12.0.redhat-610379]
	at
org.apache.camel.component.ldap.LdapProducer.process(LdapProducer.java:71)[857:org.apache.camel.camel-ldap:2.12.0.redhat-610379]
	at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
	at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
	at
org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.asyncInvoke(CxfRsInvoker.java:90)[214:org.apache.camel.camel-cxf:2.12.0.redhat-610379]
	at
org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:57)[214:org.apache.camel.camel-cxf:2.12.0.redhat-610379]
	at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)[173:org.apache.cxf.cxf-api:2.7.0.redhat-610379]
	at
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:205)[184:org.apache.cxf.cxf-rt-frontend-jaxrs:2.7.0.redhat-610379]
	at
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:102)[184:org.apache.cxf.cxf-rt-frontend-jaxrs:2.7.0.redhat-610379]
	at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[173:org.apache.cxf.cxf-api:2.7.0.redhat-610379]
	at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)[173:org.apache.cxf.cxf-api:2.7.0.redhat-610379]
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)[173:org.apache.cxf.cxf-api:2.7.0.redhat-610379]
	at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[173:org.apache.cxf.cxf-api:2.7.0.redhat-610379]
	at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:355)[192:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.0.redhat-610379]
	at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:319)[192:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.0.redhat-610379]
	at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[192:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.0.redhat-610379]
	at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.Server.handle(Server.java:366)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
Caused by: javax.naming.NotContextException: Cannot create context for:
ldap://DomainDnsZones.swm.com.ar/DC=DomainDnsZones,DC=swm,DC=com,DC=ar;
remaining name 'DC=swm,DC=com,DC=ar'
	at
com.sun.jndi.ldap.LdapReferralContext.<init>(LdapReferralContext.java:141)[:1.7.0_71]
	at
com.sun.jndi.ldap.LdapReferralException.getReferralContext(LdapReferralException.java:150)[:1.7.0_71]
	at
com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreReferrals(LdapNamingEnumeration.java:357)[:1.7.0_71]
	at
com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreImpl(LdapNamingEnumeration.java:226)[:1.7.0_71]






--
View this message in context: http://camel.465427.n5.nabble.com/Ldap-query-exception-tp5779904.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Ldap query exception

Posted by rburdet <ro...@semperti.com>.
My route and bean configs: 

	<cxf:rsServer id="tokenEndpoint"
address="http://0.0.0.0:18181/smg/processes/bdc/"
		serviceClass="ar.com.smg.sgi.esb.proxyrightnow.model.TokenService" />

   <cm:property-placeholder id="propertiesService"
persistent-id="ar.com.smg.esb.service">
        <cm:default-properties>
            <cm:property name="LDAP_URL" value=""/>
			<cm:property name="LDAP_AUTHENTICATION" value=""/>
           	<cm:property name="LDAP_PRINCIPAL" value=""/>
           	<cm:property name="LDAP_CREDENTIALS" value=""/>
        </cm:default-properties>
    </cm:property-placeholder>


	<bean id="tokenizer"
class="ar.com.smg.sgi.esb.proxyrightnow.model.Tokenizer"/>
	<bean id="getUser" class="ar.com.smg.sgi.esb.proxyrightnow.model.Parser"/>
  
  <propertyPlaceholder
location="file:${karaf.home}/etc/ar.com.smg.esb.service.cfg"
prefixToken="[[" suffixToken="]]" id="properties"/>
  <route id="RestEndpoint">
    
    <from uri="cxfrs:bean:tokenEndpoint"/>

    <setHeader headerName="RN_KEY">
      <simple>[[RN_KEY]]</simple>
    </setHeader>
    <setHeader headerName="URL_RIGHTNOW">
      <simple>[[URL_RIGHTNOW]]</simple>
    </setHeader>
    <setHeader headerName="oldBody">
      <simple>${body}</simple>
    </setHeader>
    <setHeader headerName="OU">
    	<simple>[[GROUP_ROL]]</simple>
    </setHeader>
    <process ref="getUser"/>
    <to uri="ldap:ldapserver?base=[[BASE_DN]]"/>
    <process ref="tokenizer"/>
  </route>
</camelContext>



--
View this message in context: http://camel.465427.n5.nabble.com/Ldap-query-exception-tp5779904p5779908.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Ldap query exception

Posted by "Walzer, Thomas" <th...@integratix.net>.
Please share your route.


> Am 28.03.2016 um 18:39 schrieb rburdet <ro...@semperti.com>:
> 
> Hi, im working on an application that needs to make a query to a ldap server.
> 
> My bean is :
>      <bean id="ldapserver" class="javax.naming.directory.InitialDirContext"
> scope="prototype">
>        <argument>
>            <props>
>                <prop key="java.naming.factory.initial"
> value="com.sun.jndi.ldap.LdapCtxFactory"/>
>                <prop key="java.naming.provider.url" value="${LDAP_URL}"/>
>                <prop key="java.naming.security.authentication"
> value="${LDAP_AUTHENTICATION}" />
>                <prop key="java.naming.security.principal" value="${LDAP_PRINCIPAL}"/>
>                <prop key="java.naming.security.credentials"
> value="${LDAP_CREDENTIALS}"/>
>                <prop key="java.naming.referral" value="follow"/>            
>            </props>
>        </argument>
>       </bean>    
> 
> The query im trying to achieve is: 
>        String queryLdap =
> "(&(objectClass=user)(sAMAccountName="+userName+")(memberOf="+OU+"))";
> 
> My ldap component in camel route : 
> <to uri="ldap:ldapserver?base=[[BASE_DN]]"/>
> 
> And the stacktrace of the exception is at the bottom.
> 
> I cannot find any clues to this issue. 
> Any help is appreciated.
> 
> 
> Stacktrace:
> ---------------------------------------------------------------------------------------------------------------------------------------
> javax.naming.PartialResultException [Root exception is
> javax.naming.NotContextException: Cannot create context for:
> ldap://DomainDnsZones.swm.com.ar/DC=DomainDnsZones,DC=swm,DC=com,DC=ar;
> remaining name 'DC=swm,DC=com,DC=ar']
>    at
> com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreImpl(LdapNamingEnumeration.java:242)[:1.7.0_71]
>    at
> com.sun.jndi.ldap.LdapNamingEnumeration.hasMore(LdapNamingEnumeration.java:189)[:1.7.0_71]
>    at
> org.apache.camel.component.ldap.LdapProducer.simpleSearch(LdapProducer.java:101)[857:org.apache.camel.camel-ldap:2.12.0.redhat-610379]
>    at
> org.apache.camel.component.ldap.LdapProducer.process(LdapProducer.java:71)[857:org.apache.camel.camel-ldap:2.12.0.redhat-610379]
>    at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
>    at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
>    at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
>    at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
>    at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
>    at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
>    at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
>    at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[151:org.apache.camel.camel-core:2.12.0.redhat-610379]
>    at
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.asyncInvoke(CxfRsInvoker.java:90)[214:org.apache.camel.camel-cxf:2.12.0.redhat-610379]
>    at
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:57)[214:org.apache.camel.camel-cxf:2.12.0.redhat-610379]
>    at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)[173:org.apache.cxf.cxf-api:2.7.0.redhat-610379]
>    at
> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:205)[184:org.apache.cxf.cxf-rt-frontend-jaxrs:2.7.0.redhat-610379]
>    at
> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:102)[184:org.apache.cxf.cxf-rt-frontend-jaxrs:2.7.0.redhat-610379]
>    at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[173:org.apache.cxf.cxf-api:2.7.0.redhat-610379]
>    at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)[173:org.apache.cxf.cxf-api:2.7.0.redhat-610379]
>    at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)[173:org.apache.cxf.cxf-api:2.7.0.redhat-610379]
>    at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[173:org.apache.cxf.cxf-api:2.7.0.redhat-610379]
>    at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:355)[192:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.0.redhat-610379]
>    at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:319)[192:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.0.redhat-610379]
>    at
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[192:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.0.redhat-610379]
>    at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.server.Server.handle(Server.java:366)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[101:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
>    at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
> Caused by: javax.naming.NotContextException: Cannot create context for:
> ldap://DomainDnsZones.swm.com.ar/DC=DomainDnsZones,DC=swm,DC=com,DC=ar;
> remaining name 'DC=swm,DC=com,DC=ar'
>    at
> com.sun.jndi.ldap.LdapReferralContext.<init>(LdapReferralContext.java:141)[:1.7.0_71]
>    at
> com.sun.jndi.ldap.LdapReferralException.getReferralContext(LdapReferralException.java:150)[:1.7.0_71]
>    at
> com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreReferrals(LdapNamingEnumeration.java:357)[:1.7.0_71]
>    at
> com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreImpl(LdapNamingEnumeration.java:226)[:1.7.0_71]
> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Ldap-query-exception-tp5779904.html
> Sent from the Camel - Users mailing list archive at Nabble.com.