Hi everyone,

camel: 2.8.0

Could anyone tell me how to initialize a LdapContext (as opposed to a 
DirContext) in a blueprint environment?
I would like to query an ldap-server and I have to use pagesize.
An example would be fantastic.

Best regards,
Thomas.

--- My blueprint:

<?xml version="1.0" encoding="UTF-8"?>

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:camel="http://camel.apache.org/schema/blueprint";
       xsi:schemaLocation="
       http://www.osgi.org/xmlns/blueprint/v1.0.0 
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
       http://camel.apache.org/schema/blueprint 
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd";>

<bean id="ldapserver" class="javax.naming.ldap.InitialLdapContext" 
scope="prototype">
     <argument>
          <props>
             <prop 
key="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</prop>
             <prop key="java.naming.provider.url">ldap://myserver</prop>
             <prop key="java.naming.security.authentication">simple</prop>
             <prop key="java.naming.security.principal">user</prop>
             <prop key="java.naming.security.credentials">secret</prop>
             <prop key="java.naming.referral">follow</prop>
          </props>
     </argument>
</bean>


<camelContext trace="false" id="ctxLDAP" 
xmlns="http://camel.apache.org/schema/blueprint";>    
    <route id="rtLDAP" autoStartup="true">
        <from uri="timer://foo?period=60000"/>
        <setBody>
            <constant>(sn=*)</constant>
        </setBody>
        <to 
uri="ldap:ldapserver?base=DC=some,DC=thing&amp;pageSize=1000&amp;returnedAttributes=sn,samaccountname"/>
        <split>
            <simple>${body}</simple>
            <log message="=== ${body}"/>    
        </split>        
    </route>
</camelContext>
</blueprint>
    
--- servicemix.log:

Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: 
Unable to find a matching constructor on class 
javax.naming.ldap.InitialLdapContext for arguments 
[{java.naming.provider.url=ldap://myserver, 
java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory, 
java.naming.security.principal=user, 
java.naming.security.authentication=simple, 
java.naming.security.credentials=secret, java.naming.referral=follow}] when 
instanciating bean ldapserver
        at 
org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:274)[10:org.apache.aries.blueprint:0.3.2]
        at 
org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:708)[10:org.apache.aries.blueprint:0.3.2]
        at 
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[10:org.apache.aries.blueprint:0.3.2]
        at 
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[10:org.apache.aries.blueprint:0.3.2]
---
I understand that this is the wrong constructor, at least the controls are 
missing. But I don´t get how to initialize them...

Reply via email to