On 01/08/2017 15:59, Dino Mifsud wrote:
Thanks for your reply..but does the Search script need to return all records at once or the SearchScript is executed every time for each entry in the Syncope users?

Of course not: the search script should return only the records matching the passed query: see

https://github.com/apache/syncope/blob/2_0_X/fit/core-reference/src/test/resources/rest/SearchScript.groovy#L76-L93

for example: it's Scripted REST (not Scripted SQL), but the concept is the same.

Regards.

On 01 Aug 2017, at 1:57 PM, Francesco Chicchiriccò <ilgro...@apache.org <mailto:ilgro...@apache.org>> wrote:

On 01/08/2017 13:42, Dino Mifsud wrote:
Hi
I am trying to sync users from Syncope to a backend DB using scriptesql connector. The users are being created (in the tables) but a subsequent call creates again the users duplicating them. Also I am getting this error in the Search script which I cannot solve. See stack trace below.
Can you help me please? much appreciated

Hi Dino,
glad to see that you are progressing.

The error below (and also the duplication of entries that you observe) derive from an incomplete / erroneous implementation of the search script: you must ensure that:

1. the search scripts effectively founds the item it was requested to (if such item is effectively existing in the external database): look in the core-connid.log right before the second, unwanted, create()

2. the search scripts returns all the attributes it was asked for by Syncope: you should find, prior to the error message below, in core-connid.log something like as

13:41:25.136 DEBUG Enter: search(ObjectClass: __ACCOUNT__, EQUALS: Attribute: {Name=fullname, Value=[17b7da3asyncope...@apache.org <mailto:17b7da3asyncope...@apache.org>]}, org.apache.syncope.core.provisioning.java.ConnectorFacadeProxy$2@6afd8683, OperationOptions: {ATTRS_TO_GET:[__NAME__,fullname,__UID__,__ENABLE__]}) Method: search

in this case, Syncope is asking for [__NAME__,fullname,__UID__,__ENABLE__] to be available in the results: if not all attributes are included, you receive the "XXX was returned by the connector but failed to pass the framework filter. This seems like wrong implementation of the filter in the connector" error message.

HTH
Regards.

12:04:41.720 DEBUG Search script loadedMethod: executeQuery
12:04:41.720 DEBUG ObjectClass: __ACCOUNT__Method: executeQuery
12:04:41.720 INFO  Entering SEARCH Script**************Method: run
12:04:41.722 INFO  GGOO SEARCH SCRIPT......Method: run
12:04:41.722 DEBUG Search okMethod: executeQuery
12:04:41.722 DEBUG Enter: {Uid=Attribute: {Name=__UID__, Value=[17e4c35c-383f-1035-9abe-d7b00eb73b03]}, ObjectClass=ObjectClass: __ACCOUNT__, Attributes=[Attribute: {Name=uid, Value=[administrator]}, Attribute: {Name=__NAME__, Value=[administrator]}, Attribute: {Name=cn, Value=[administrator]}, Attribute: {Name=__UID__, Value=[17e4c35c-383f-1035-9abe-d7b00eb73b03]}], Name=Attribute: {Name=__NAME__, Value=[administrator]}}Method: handle
12:04:41.722 DEBUG Exception:Method: handle
java.lang.IllegalStateException: Object {Uid=Attribute: {Name=__UID__, Value=[17e4c35c-383f-1035-9abe-d7b00eb73b03]}, ObjectClass=ObjectClass: __ACCOUNT__, Attributes=[Attribute: {Name=__NAME__, Value=[administrator]}, Attribute: {Name=__UID__, Value=[17e4c35c-383f-1035-9abe-d7b00eb73b03]}], Name=Attribute: {Name=__NAME__, Value=[administrator]}} was returned by the connector but failed to pass the framework filter. This seems like wrong implementation of the filter in the connector. at org.identityconnectors.framework.impl.api.local.operations.FilteredResultsHandler.handle(FilteredResultsHandler.java:82) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl$AttributesToGetSearchResultsHandler.handle(SearchImpl.java:278) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl$1.handle(SearchImpl.java:142) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.SearchResultsHandlerLoggingProxy.handle(SearchResultsHandlerLoggingProxy.java:64) ~[connector-framework-internal-1.4.2.0.jar:?] at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.processResults(ScriptedSQLConnector.java:586) ~[?:?] at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.executeQuery(ScriptedSQLConnector.java:403) ~[?:?] at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.executeQuery(ScriptedSQLConnector.java:61) ~[?:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl.rawSearch(SearchImpl.java:193) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl.search(SearchImpl.java:130) ~[connector-framework-internal-1.4.2.0.jar:?]
at sun.reflect.GeneratedMethodAccessor239.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.local.operations.ConnectorAPIOperationRunnerProxy.invoke(ConnectorAPIOperationRunnerProxy.java:98) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy256.search(Unknown Source) ~[?:?]
at org.identityconnectors.framework.impl.api.local.operations.GetImpl.getObject(GetImpl.java:67) ~[connector-framework-internal-1.4.2.0.jar:?]
at sun.reflect.GeneratedMethodAccessor199.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.local.operations.ThreadClassLoaderManagerProxy.invoke(ThreadClassLoaderManagerProxy.java:96) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy263.getObject(Unknown Source) ~[?:?]
at sun.reflect.GeneratedMethodAccessor199.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.DelegatingTimeoutProxy.invoke(DelegatingTimeoutProxy.java:99) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy263.getObject(Unknown Source) ~[?:?]
at sun.reflect.GeneratedMethodAccessor199.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.LoggingProxy.invoke(LoggingProxy.java:83) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy263.getObject(Unknown Source) ~[?:?]
at org.identityconnectors.framework.impl.api.AbstractConnectorFacade.getObject(AbstractConnectorFacade.java:261) ~[connector-framework-internal-1.4.2.0.jar:?] at org.apache.syncope.core.provisioning.java.AsyncConnectorFacade.getObject(AsyncConnectorFacade.java:104) ~[syncope-core-provisioning-java-2.0.4.jar:2.0.4] at org.apache.syncope.core.provisioning.java.AsyncConnectorFacade$$FastClassBySpringCGLIB$$886ae36a.invoke(<generated>) ~[syncope-core-provisioning-java-2.0.4.jar:2.0.4] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
12:04:41.722 DEBUG Exception:Method: executeQuery
org.identityconnectors.framework.common.exceptions.ConnectorException: Search script error at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.executeQuery(ScriptedSQLConnector.java:405) ~[?:?] at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.executeQuery(ScriptedSQLConnector.java:61) ~[?:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl.rawSearch(SearchImpl.java:193) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl.search(SearchImpl.java:130) ~[connector-framework-internal-1.4.2.0.jar:?]
at sun.reflect.GeneratedMethodAccessor239.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.local.operations.ConnectorAPIOperationRunnerProxy.invoke(ConnectorAPIOperationRunnerProxy.java:98) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy256.search(Unknown Source) ~[?:?]
at org.identityconnectors.framework.impl.api.local.operations.GetImpl.getObject(GetImpl.java:67) ~[connector-framework-internal-1.4.2.0.jar:?]
at sun.reflect.GeneratedMethodAccessor199.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.local.operations.ThreadClassLoaderManagerProxy.invoke(ThreadClassLoaderManagerProxy.java:96) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy263.getObject(Unknown Source) ~[?:?]
at sun.reflect.GeneratedMethodAccessor199.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.DelegatingTimeoutProxy.invoke(DelegatingTimeoutProxy.java:99) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy263.getObject(Unknown Source) ~[?:?]
at sun.reflect.GeneratedMethodAccessor199.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.LoggingProxy.invoke(LoggingProxy.java:83) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy263.getObject(Unknown Source) ~[?:?]
at org.identityconnectors.framework.impl.api.AbstractConnectorFacade.getObject(AbstractConnectorFacade.java:261) ~[connector-framework-internal-1.4.2.0.jar:?] at org.apache.syncope.core.provisioning.java.AsyncConnectorFacade.getObject(AsyncConnectorFacade.java:104) ~[syncope-core-provisioning-java-2.0.4.jar:2.0.4] at org.apache.syncope.core.provisioning.java.AsyncConnectorFacade$$FastClassBySpringCGLIB$$886ae36a.invoke(<generated>) ~[syncope-core-provisioning-java-2.0.4.jar:2.0.4] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
Caused by: java.lang.IllegalStateException: Object {Uid=Attribute: {Name=__UID__, Value=[17e4c35c-383f-1035-9abe-d7b00eb73b03]}, ObjectClass=ObjectClass: __ACCOUNT__, Attributes=[Attribute: {Name=__NAME__, Value=[administrator]}, Attribute: {Name=__UID__, Value=[17e4c35c-383f-1035-9abe-d7b00eb73b03]}], Name=Attribute: {Name=__NAME__, Value=[administrator]}} was returned by the connector but failed to pass the framework filter. This seems like wrong implementation of the filter in the connector. at org.identityconnectors.framework.impl.api.local.operations.FilteredResultsHandler.handle(FilteredResultsHandler.java:82) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl$AttributesToGetSearchResultsHandler.handle(SearchImpl.java:278) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl$1.handle(SearchImpl.java:142) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.SearchResultsHandlerLoggingProxy.handle(SearchResultsHandlerLoggingProxy.java:64) ~[connector-framework-internal-1.4.2.0.jar:?] at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.processResults(ScriptedSQLConnector.java:586) ~[?:?] at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.executeQuery(ScriptedSQLConnector.java:403) ~[?:?]
... 35 more
12:04:41.722 DEBUG Exception:Method: getObject
org.identityconnectors.framework.common.exceptions.ConnectorException: Search script error at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.executeQuery(ScriptedSQLConnector.java:405) ~[?:?] at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.executeQuery(ScriptedSQLConnector.java:61) ~[?:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl.rawSearch(SearchImpl.java:193) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl.search(SearchImpl.java:130) ~[connector-framework-internal-1.4.2.0.jar:?]
at sun.reflect.GeneratedMethodAccessor239.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.local.operations.ConnectorAPIOperationRunnerProxy.invoke(ConnectorAPIOperationRunnerProxy.java:98) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy256.search(Unknown Source) ~[?:?]
at org.identityconnectors.framework.impl.api.local.operations.GetImpl.getObject(GetImpl.java:67) ~[connector-framework-internal-1.4.2.0.jar:?]
at sun.reflect.GeneratedMethodAccessor199.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.local.operations.ThreadClassLoaderManagerProxy.invoke(ThreadClassLoaderManagerProxy.java:96) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy263.getObject(Unknown Source) ~[?:?]
at sun.reflect.GeneratedMethodAccessor199.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.DelegatingTimeoutProxy.invoke(DelegatingTimeoutProxy.java:99) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy263.getObject(Unknown Source) ~[?:?]
at sun.reflect.GeneratedMethodAccessor199.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.identityconnectors.framework.impl.api.LoggingProxy.invoke(LoggingProxy.java:83) ~[connector-framework-internal-1.4.2.0.jar:?]
at com.sun.proxy.$Proxy263.getObject(Unknown Source) ~[?:?]
at org.identityconnectors.framework.impl.api.AbstractConnectorFacade.getObject(AbstractConnectorFacade.java:261) ~[connector-framework-internal-1.4.2.0.jar:?] at org.apache.syncope.core.provisioning.java.AsyncConnectorFacade.getObject(AsyncConnectorFacade.java:104) ~[syncope-core-provisioning-java-2.0.4.jar:2.0.4] at org.apache.syncope.core.provisioning.java.AsyncConnectorFacade$$FastClassBySpringCGLIB$$886ae36a.invoke(<generated>) ~[syncope-core-provisioning-java-2.0.4.jar:2.0.4] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115) ~[spring-aop-4.3.9.RELEASE.jar:4.3.9.RELEASE] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
Caused by: java.lang.IllegalStateException: Object {Uid=Attribute: {Name=__UID__, Value=[17e4c35c-383f-1035-9abe-d7b00eb73b03]}, ObjectClass=ObjectClass: __ACCOUNT__, Attributes=[Attribute: {Name=__NAME__, Value=[administrator]}, Attribute: {Name=__UID__, Value=[17e4c35c-383f-1035-9abe-d7b00eb73b03]}], Name=Attribute: {Name=__NAME__, Value=[administrator]}} was returned by the connector but failed to pass the framework filter. This seems like wrong implementation of the filter in the connector. at org.identityconnectors.framework.impl.api.local.operations.FilteredResultsHandler.handle(FilteredResultsHandler.java:82) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl$AttributesToGetSearchResultsHandler.handle(SearchImpl.java:278) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.local.operations.SearchImpl$1.handle(SearchImpl.java:142) ~[connector-framework-internal-1.4.2.0.jar:?] at org.identityconnectors.framework.impl.api.SearchResultsHandlerLoggingProxy.handle(SearchResultsHandlerLoggingProxy.java:64) ~[connector-framework-internal-1.4.2.0.jar:?] at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.processResults(ScriptedSQLConnector.java:586) ~[?:?] at net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.executeQuery(ScriptedSQLConnector.java:403) ~[?:?]
... 35 more

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/

Reply via email to