IdentityService user query causes "java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectUserByQueryCriteria"

Hello all,

I’m facing the exception below while trying to query user details from the IdentityService in my ServiceTask. I configured flowable with the users stored in the database (Postgresql) and in LDAP (OpenDJ), both results to the same behavior. Login to the flowable modeler etc. works fine.

What do I miss? Does flowable support querying user information through the IdentityService with LDAP?

In my ServiceTask class:
processEngine = ProcessEngines.getDefaultProcessEngine();
user = processEngine.getIdentityService().createUserQuery().userId(id).singleResult();

Exception:

Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectUserByQueryCriteria

    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
    at org.flowable.engine.common.impl.db.DbSqlSession.selectListWithRawParameter(DbSqlSession.java:202)
    at org.flowable.engine.common.impl.db.DbSqlSession.selectListWithRawParameter(DbSqlSession.java:196)
    at org.flowable.engine.common.impl.db.DbSqlSession.selectList(DbSqlSession.java:158)
    at org.flowable.idm.engine.impl.persistence.entity.data.impl.MybatisUserDataManager.findUserByQueryCriteria(MybatisUserDataManager.java:48)
    at org.flowable.idm.engine.impl.persistence.entity.UserEntityManagerImpl.findUserByQueryCriteria(UserEntityManagerImpl.java:94)
    at org.flowable.idm.engine.impl.UserQueryImpl.executeList(UserQueryImpl.java:228)
    at org.flowable.engine.common.impl.AbstractQuery.executeSingleResult(AbstractQuery.java:161)
    at org.flowable.engine.common.impl.AbstractQuery.execute(AbstractQuery.java:145)
    at org.flowable.engine.common.impl.interceptor.DefaultCommandInvoker.execute(DefaultCommandInvoker.java:10)
    at org.flowable.engine.common.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
    at org.flowable.engine.common.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:72)
    at org.flowable.engine.common.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:35)
    at org.flowable.engine.common.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
    at org.flowable.engine.common.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
    at org.flowable.engine.common.impl.AbstractQuery.singleResult(AbstractQuery.java:104)
    at com.c10n.styx.service.QueryEmployeeInfo.execute(QueryEmployeeInfo.java:26)
    at org.flowable.engine.impl.delegate.invocation.JavaDelegateInvocation.invoke(JavaDelegateInvocation.java:35)
    at org.flowable.engine.impl.delegate.invocation.DelegateInvocation.proceed(DelegateInvocation.java:35)
    at org.flowable.engine.impl.delegate.invocation.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:26)
    at org.flowable.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:48)
    at org.flowable.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:200)
    at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeActivityBehavior(ContinueProcessOperation.java:256)
    at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeSynchronous(ContinueProcessOperation.java:154)
    at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughFlowNode(ContinueProcessOperation.java:111)
    at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughSequenceFlow(ContinueProcessOperation.java:303)
    at org.flowable.engine.impl.agenda.ContinueProcessOperation.run(ContinueProcessOperation.java:77)
    at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:88)
    at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72)
    at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56)
    at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:25)
    at org.flowable.engine.common.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
    at org.flowable.engine.common.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:72)
    at org.flowable.idm.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:49)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    at org.flowable.idm.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:46)
    at org.flowable.engine.common.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:35)
    at org.flowable.engine.common.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
    at org.flowable.engine.common.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
    at org.flowable.engine.impl.TaskServiceImpl.completeTaskWithForm(TaskServiceImpl.java:230)
    at org.flowable.app.service.runtime.FlowableTaskFormService.completeTaskForm(FlowableTaskFormService.java:114)
    at org.flowable.app.service.runtime.FlowableTaskFormService$$FastClassBySpringCGLIB$$4bc0670c.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
    at org.flowable.app.service.runtime.FlowableTaskFormService$$EnhancerBySpringCGLIB$$f1a6d8b0.completeTaskForm(<generated>)
    at org.flowable.app.rest.runtime.TaskFormResource.completeTaskForm(TaskFormResource.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.flowable.app.filter.FlowableCookieFilter.doFilterInternal(FlowableCookieFilter.java:156)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748) 
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectUserByQueryCriteria
    at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:860)
    at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:693)
    at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:686)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)

Any help would be appreciated. Best regards,
Julien

As far as I know you have to configure the IDM App for LDAP, see http://www.flowable.org/docs/userguide/index.html#flowableIDMApp for details.

Then you also have to configure the process engine to use the IDM App (unless you use the Task App to execute the processes and run the IDM app and the Task App in the same servlet container).

The exception seems to indicate it didn’t find the identity MyBatis files for identity. How did you configure your flowable dependencies (maven/gradle/whatever)?

I used the flowable docker container available on docker hub. I have added a flowable-ui-app.properties file containing my configuration and the database driver for PostgreSQL to the classpath. In the configuration file i added the ldap configuration properties described in the flowable userguide chapter 14.2 as follow:

ldap.enabled=true
ldap.server=ldap://<ldap_server>
ldap.port=389
ldap.user=<ldap_user>
ldap.password=<ldap_user_password>
ldap.basedn=<base_dn>
ldap.query.userbyid=(&(objectClass=inetOrgPerson)(uid={0}))
ldap.query.userbyname=(&(objectClass=inetOrgPerson)(|({0}={1})({2}={3})))
ldap.query.userall=(objectClass=inetOrgPerson)
ldap.query.groupsforuser=(&(objectClass=groupOfNames)(member={0}))
ldap.query.groupall=(objectClass=groupOfNames)
ldap.attribute.userid=uid
ldap.attribute.firstname=givenName
ldap.attribute.lastname=sn
ldap.attribute.groupid=cn
ldap.attribute.groupname=cn
ldap.attribute.email=mail
ldap.cache.groupsize=10000

Login to the Web Apps works properly with the credentials specified in my LDAP directory.

Thanks a lot for your help!

Thanks for pasting back the solution that worked for you!

Hi. What if I’m not using LDAP but still getting this error?

I’m using Postgres, flowable-task 6.2.1. Not getting this error in unit testing using H2 so guessing it’s something to do with mybatis mappings for Postgres. But not sure where to look.

My code:

    List<User> users = identityService.createUserQuery().memberOfGroups(groupIds).list();

Error:

01:03:11,900 [qtp1451043227-978] ERROR org.flowable.engine.common.impl.interceptor.CommandContext - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectUserByQueryCriteria

Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectUserByQueryCriteria

    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
    at org.flowable.engine.common.impl.db.DbSqlSession.selectListWithRawParameter(DbSqlSession.java:202)


Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectUserByQueryCriteria
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:860)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:693)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:686)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
… 139 more

Ok, so I don’t have the identityservice configured in my flowable-task. So learning from another thread, I tried to use the RemoteIdmService. The service throws this error (shortened for legibility):

02:59:57,907 [qtp1451043227-57] DEBUG org.apache.http.wire - http-outgoing-2 >> “GET /flowable-idm/api/idm/groups/mygroup/users HTTP/1.1[\r][\n]”

02:59:57,939 [qtp1451043227-57] DEBUG org.apache.http.wire - http-outgoing-2 << “HTTP/1.1 404 Not Found[\r][\n]”

02:59:57,943 [qtp1451043227-57] DEBUG org.apache.http.wire - http-outgoing-2 << “Problem accessing /flowable-idm/api/idm/groups/mygroup/users. Reason:”
02:59:57,943 [qtp1451043227-57] DEBUG org.apache.http.wire - http-outgoing-2 << “Not Found”

It’s not a valid request! Looking at org.flowable.app.rest.api.ApiGroupsResource, there is no mapping for the /users query.

Come on! Is this code completely untested? Or am I clueless here. Something as simple as querying for users in a group shouldn’t be this complicated.