RS 2.2.2 - LDAPImport problem

I am getting the following error while running the ldapimport.groovy script:

Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘net.datenwerke.security.service.usermanager.entities.OrganisationalUnit@7470’ with class ‘net.datenwerke.security.service.usermanager.entities.AbstractUserManagerNode_$$_javassist_1’ to class ‘net.datenwerke.security.service.usermanager.entities.OrganisationalUnit’
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)
at ldap.LdapUserLoader.createOUNode(Script19.groovy:367)
at ldap.LdapUserLoader.this$2$createOUNode(Script19.groovy)
at ldap.LdapUserLoader$this$2$createOUNode.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
at ldap.LdapUserLoader.loadFromDirectory(Script19.groovy:294)

On 2.2.1 this worked OK.
The offending line is the following:
OrganisationalUnit node = (OrganisationalUnit) guidMap.get(getGuid(sr));

Casting it to AbstractUserManagerNode works, but then it’s impossible to add an object of type AbstractUserManagerNode to the OrganizationalUnit class [ parent.addChild(node) ]

Hi,

can you try this updated version of the import script?
I can’t test it myself right now, but that should take care of this issue.
Let me know, if it works, so I can update the blog post.

http://www2.datenwerke.net/files/forum/ldapimport.groovy

Cheers,
Thorsten

Well, I don’t see anything in that code that would actually call the run method of LdapRunner (or create an instance of it, for that matter), so can’t test.

Ups, sorry.

Add this Line before the LdapRunner Class Definition

GLOBALS.getInstance(LdapRunner.class).run(GLOBALS);

Or use the updated script: http://www2.datenwerke.net/files/forum/ldapimport.groovy

works now, thank you.