Hi lsc community!
I would like to switch our lsc installation (DB to LDAP, c.a. 15000
entries) from synchronous to asynchronous mode.
For testing I wanted to try to sync just the userpassword field from the
database (Oracle) to LDAP (OpenDJ). I am using lsc 2.0.2.
First I created and tested a syncronous configuration. Then I modified the
lsc.xml config to include
<requestNameForNextId>getInetOrgPersonNext</requestNameForNextId>
and added
<select id="getInetOrgPersonNext" resultClass="java.util.HashMap">
SELECT cn
FROM ldap_sync
WHERE id = (SELECT MAX(id) FROM ldap_sync)
</select>
to my InetOrgPerson.xml file (cn being my pivot attribute). The
"ldap_sync" view contains the "cn" values for all the changed records in
the database.
There is no complete example for async mode in the documentation, So I
just guessed that "requestNameForNextId" should return the value of the
pivot attribute for the next changed record. Obviously i'm missing out
something, because it does not work. I tried several modifications but no
luck.
******************
If anyone can post a full example how to use asynchronous mode with a jdbc
source and ldap destination, that would be great
*****************
I tried some more...
Switched to a static select for testing
<select id="getInetOrgPersonNext" resultClass="java.util.HashMap">
SELECT 'puescheo' AS cn FROM dual
</select>
but still I get the same errors:
$ bin/lsc-gdldaptestpw -a all -t 1
May 13 17:46:31 - DEBUG - Loading XML configuration from:
/home/puescheo/lsc2/gdldaptestpw/bin/../etc/lsc.xml
May 13 17:46:32 - INFO - Reflections took 407 ms to scan 1 urls,
producing 60 keys and 226 values
May 13 17:46:32 - DEBUG - Importing XML schema file:
schemas/lsc-core-2.0.xsd
May 13 17:46:32 - INFO - Logging configuration successfully loaded from
/home/puescheo/lsc2/gdldaptestpw/bin/../etc/logback.xml
May 13 17:46:32 - INFO - LSC configuration successfully loaded from
/home/puescheo/lsc2/gdldaptestpw/bin/../etc/
May 13 17:46:32 - INFO - Connecting to LDAP server
ldap://gdldaptest1.accounts.intern:389/dc=gi-de,dc=com as cn=Directory
Manager
May 13 17:46:32 - DEBUG - Reading sql-map-config.xml from
file:/home/puescheo/lsc2/gdldaptestpw/bin/../etc/sql-map-config.xml
May 13 17:46:33 - INFO - Starting async for PasswordSyncTask
May 13 17:46:33 - DEBUG - Asynchronous synchronize PasswordSyncTask
May 13 17:46:33 - ERROR - Error while synchronizing ID puescheo:
java.util.NoSuchElementException
May 13 17:46:33 - DEBUG - java.util.NoSuchElementException
java.util.NoSuchElementException: null
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:897)
~[na:1.7.0_17]
at java.util.HashMap$KeyIterator.next(HashMap.java:928)
~[na:1.7.0_17]
at
org.lsc.LscDatasets.getStringValueAttribute(LscDatasets.java:81)
~[lsc-core-2.0.2.jar:na]
at
org.lsc.jndi.AbstractSimpleJndiService.get(AbstractSimpleJndiService.java:247)
~[lsc-core-2.0.2.jar:na]
at
org.lsc.jndi.SimpleJndiDstService.getBean(SimpleJndiDstService.java:122)
~[lsc-core-2.0.2.jar:na]
at org.lsc.SynchronizeTask.run(AbstractSynchronize.java:714)
[lsc-core-2.0.2.jar:na]
at org.lsc.SynchronizeTask.run(AbstractSynchronize.java:673)
[lsc-core-2.0.2.jar:na]
at org.lsc.SynchronizeTask.run(AbstractSynchronize.java:652)
[lsc-core-2.0.2.jar:na]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_17]
The lsc.xml used is as follows:
<?xml version="1.0" ?>
<lsc xmlns="http://lsc-project.org/XSD/lsc-core-2.0.xsd" revision="0">
<connections>
<databaseConnection>
<name>edatadb-src-conn</name>
<url>jdbc:oracle:thin:@****************************</url>
<username>**********</username>
<password>********</password>
<driver>oracle.jdbc.driver.OracleDriver</driver>
</databaseConnection>
<ldapConnection>
<name>gdldap-dst-conn</name>
<url>ldap://******************/dc=gi-de,dc=com</url>
<username>cn=Directory Manager</username>
<password>**************</password>
<authentication>SIMPLE</authentication>
<referral>IGNORE</referral>
<derefAliases>NEVER</derefAliases>
<version>VERSION_3</version>
<pageSize>500</pageSize>
<factory>com.sun.jndi.ldap.LdapCtxFactory</factory>
</ldapConnection>
</connections>
<tasks>
<task>
<name>PasswordSyncTask</name>
<bean>org.lsc.beans.SimpleBean</bean>
<databaseSourceService>
<name>pw-edatadb-src-service</name>
<connection reference="edatadb-src-conn" />
<requestNameForList>getInetOrgPersonList</requestNameForList>
<requestNameForObject>getInetOrgPerson</requestNameForObject>
<requestNameForNextId>getInetOrgPersonNext</requestNameForNextId>
<requestNameForClean>getInetOrgPersonClean</requestNameForClean>
</databaseSourceService>
<ldapDestinationService>
<name>pw-gdldap-dst-service</name>
<connection reference="gdldap-dst-conn" />
<baseDn>ou=People,dc=gi-de,dc=com</baseDn>
<pivotAttributes>
<string>cn</string>
</pivotAttributes>
<fetchedAttributes>
<string>userpassword</string>
</fetchedAttributes>
<getAllFilter>(objectClass=inetorgperson)</getAllFilter>
<getOneFilter>(&(objectClass=inetorgperson)(cn={cn}))</getOneFilter>
</ldapDestinationService>
<propertiesBasedSyncOptions>
<mainIdentifier>"cn=" + srcBean.getDatasetFirstValueById("cn") +
",ou=" + srcBean.getDatasetFirstValueById("o") +
",ou=People,dc=gi-de,dc=com"</mainIdentifier>
<defaultDelimiter>;</defaultDelimiter>
<defaultPolicy>FORCE</defaultPolicy>
<conditions>
<create>false</create>
<update>true</update>
<delete>false</delete>
<changeId>false</changeId>
</conditions>
<dataset>
<name>userpassword</name>
<policy>FORCE</policy>
<defaultValues></defaultValues>
<forceValues></forceValues>
<createValues></createValues>
</dataset>
</propertiesBasedSyncOptions>
</task>
</tasks>
<security>
<encryption>
<keyfile>etc/lsc.key</keyfile>
<algorithm>AES</algorithm>
<strength>128</strength>
</encryption>
</security>
</lsc>
I'll be very happy with any help or advice!
Best reagrds
Olaf
--
Olaf Püschel (ext.)
Senior Consultant
IS4IT GmbH
externer Dienstleister im Auftrag der
Giesecke & Devrient GmbH, Prinzregentenstr. 159, 81677 München,
Deutschland
http://www.gi-de.com
Tel. +49 89 4119-3283, Fax +49 89 4119-1568
mailto:[email protected]
Vorsitzender des Aufsichtsrats: Dr. Peter-Alexander Wacker
Geschäftsführer: Dr. Karsten Ottenberg (Vorsitzender, CEO),
Michael Kuemmerle, Hans Wolfgang Kunz,
Dr. Walter Schlebusch, Dr. Peter Zattler (CFO)
Gesellschaftssitz: München, Handelsregister Amtsgericht München HRB 4619.
Bitte prüfen Sie der Umwelt zuliebe, ob der Ausdruck dieser E-Mail
erforderlich ist. _______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org
lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users