AnsweredAssumed Answered

NullPointerException in taskService with CandidateUser Query under load

Question asked by christianscheer on Apr 23, 2015
Latest reply on May 7, 2015 by christianscheer
Hi.
Under load (about 20 requests per second) i get NullPointerExceptions when i query the taskService with candidate Users against LDAP. There is no problem at a low load or with single requests.

Sample Code

taskService.createTaskQuery().taskCandidateUser(userName).processVariableValueEquals(FOERDERFALL_ID_KEY, foerderFallId).list();


After digging through the stacetrace (see below) and the Activiti Source, i found

  protected List<String> getGroupsForCandidateUser(String candidateUser) {
    // TODO: Discuss about removing this feature? Or document it properly and maybe recommend to not use it
    // and explain alternatives
in TaskQueryImpl. So i guess you guys have allready noticed something about this kind of query.
I appreciate any help in switching to a better alternative.
Unfortunally I cannot reproduce this error on my local machine, but i operations told me
the established LDAP connections are fluctuating between 60 and 120 and there is no significant high cpu load or RAM usage. We use Tomcat 8, Java 7 x64.


There is a  Custom LdapGroupManager registered, as you can see from the stacktrace. The Exception occures at super.findGroupsByUser(…, so this problem should occure independend of it.

public class CustomLdapGroupManager extends LDAPGroupManager {
    private FoerderFallKundenRolleRepository kundenRollenRepository;
    private RuntimeService runtimeService;
//Constructor with and without LDAPGroupCache ommited

    @Override
    public List<Group> findGroupsByUser(String userId) {
        List<Group> groups = super.findGroupsByUser(userId);

        // Do custom Stuff with groups and kundenRollenRepository and runtimeService
        return groups;
    }
}


I attached the processEngineConfiguration and CustomLdapConfigurator/CustomLdapGroupManager below, allthough there is (from my point of view) nothing special in it.

Stacktrace:

2015-04-22 09:31:09,503 ERROR [http-nio-8085-exec-48] com.my_company.project.workflow_webservice.exception_mapping.ProjectExceptionMapper Internal Server Error:
com.my_company.project.workflow_base.exception.ProjectSystemException: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: java.lang.NullPointerException
### Cause: java.lang.NullPointerException CallStack:
com.my_company.project.workflow_core.impl.WorkflowServiceImpl.getMoeglicheAktionenByFoerderFallForUser(100738,testUser27)

   at com.my_company.project.workflow_base.aop.ServiceExceptionMapperAspect.invoke(ServiceExceptionMapperAspect.java:37) ~[workflow-base-1.0.0-SNAPSHOT.jar:na]
   at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source) ~[na:na]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_75]
   at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_75]
   at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) ~[spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) ~[spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) ~[spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at com.sun.proxy.$Proxy75.getMoeglicheAktionenByFoerderFallForUser(Unknown Source) ~[na:na]
   at com.my_company.project.workflow_webservice.FoerderFallResource.getMoeglicheAktionenByFoerderFallForUser(FoerderFallResource.java:128) ~[workflow-webservice-1.0.0-SNAPSHOT.jar:na]
   at sun.reflect.GeneratedMethodAccessor650.invoke(Unknown Source) ~[na:na]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_75]
   at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_75]
   at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[jersey-server-2.7.jar:na]
   at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151) ~[jersey-server-2.7.jar:na]
   at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171) ~[jersey-server-2.7.jar:na]
   at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:195) ~[jersey-server-2.7.jar:na]
   at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104) ~[jersey-server-2.7.jar:na]
   at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:406) ~[jersey-server-2.7.jar:na]
   at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:350) ~[jersey-server-2.7.jar:na]
   at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106) ~[jersey-server-2.7.jar:na]
   at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259) ~[jersey-server-2.7.jar:na]
   at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [jersey-common-2.7.jar:na]
   at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [jersey-common-2.7.jar:na]
   at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [jersey-common-2.7.jar:na]
   at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [jersey-common-2.7.jar:na]
   at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [jersey-common-2.7.jar:na]
   at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:320) [jersey-common-2.7.jar:na]
   at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236) [jersey-server-2.7.jar:na]
   at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1028) [jersey-server-2.7.jar:na]
   at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373) [jersey-container-servlet-core-2.7.jar:na]
   at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381) [jersey-container-servlet-core-2.7.jar:na]
   at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:534) [jersey-container-servlet-core-2.7.jar:na]
   at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:482) [jersey-container-servlet-core-2.7.jar:na]
   at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:419) [jersey-container-servlet-core-2.7.jar:na]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.21]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.21]
   at com.my_company.project.workflow_webservice_war.CacheControlFilter.doFilter(CacheControlFilter.java:45) [CacheControlFilter.class:na]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.21]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.21]
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) [catalina.jar:8.0.21]
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [catalina.jar:8.0.21]
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [catalina.jar:8.0.21]
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [catalina.jar:8.0.21]
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.21]
   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) [catalina.jar:8.0.21]
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.21]
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) [catalina.jar:8.0.21]
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) [tomcat-coyote.jar:8.0.21]
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) [tomcat-coyote.jar:8.0.21]
   at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223) [tomcat-coyote.jar:8.0.21]
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517) [tomcat-coyote.jar:8.0.21]
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474) [tomcat-coyote.jar:8.0.21]
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_75]
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_75]
   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.21]
   at java.lang.Thread.run(Unknown Source) [na:1.7.0_75]
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: java.lang.NullPointerException
### Cause: java.lang.NullPointerException
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98) ~[mybatis-3.2.5.jar:3.2.5]
   at org.activiti.engine.impl.db.DbSqlSession.selectListWithRawParameter(DbSqlSession.java:423) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:414) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.persistence.entity.TaskEntityManager.findTasksByQueryCriteria(TaskEntityManager.java:121) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.TaskQueryImpl.executeList(TaskQueryImpl.java:1143) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.AbstractQuery.execute(AbstractQuery.java:158) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) ~[activiti-spring-5.16.4.jar:5.16.4]
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) ~[spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) ~[activiti-spring-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.AbstractQuery.list(AbstractQuery.java:132) ~[activiti-engine-5.16.4.jar:5.16.4]
   at com.my_company.project.workflow_core.impl.WorkflowServiceImpl.getMoeglicheAktionenByFoerderFallForUser(WorkflowServiceImpl.java:60) ~[workflow-core-1.0.0-SNAPSHOT.jar:na]
   at sun.reflect.GeneratedMethodAccessor649.invoke(Unknown Source) ~[na:na]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_75]
   at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_75]
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at com.my_company.project.workflow_base.aop.ServiceLoggingAspect.invoke(ServiceLoggingAspect.java:38) ~[workflow-base-1.0.0-SNAPSHOT.jar:na]
   at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source) ~[na:na]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_75]
   at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_75]
   at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
   at com.my_company.project.workflow_base.aop.ServiceExceptionMapperAspect.invoke(ServiceExceptionMapperAspect.java:29) ~[workflow-base-1.0.0-SNAPSHOT.jar:na]
   … 63 common frames omitted
Caused by: java.lang.NullPointerException: null
   at org.activiti.ldap.LDAPQueryBuilder$1.executeInContext(LDAPQueryBuilder.java:63) ~[activiti-ldap-5.16.4.jar:5.16.4]
   at org.activiti.ldap.LDAPQueryBuilder$1.executeInContext(LDAPQueryBuilder.java:56) ~[activiti-ldap-5.16.4.jar:5.16.4]
   at org.activiti.ldap.LDAPTemplate.execute(LDAPTemplate.java:44) ~[activiti-ldap-5.16.4.jar:5.16.4]
   at org.activiti.ldap.LDAPQueryBuilder.buildQueryGroupsForUser(LDAPQueryBuilder.java:56) ~[activiti-ldap-5.16.4.jar:5.16.4]
   at org.activiti.ldap.LDAPGroupManager$1.executeInContext(LDAPGroupManager.java:120) ~[activiti-ldap-5.16.4.jar:5.16.4]
   at org.activiti.ldap.LDAPGroupManager$1.executeInContext(LDAPGroupManager.java:116) ~[activiti-ldap-5.16.4.jar:5.16.4]
   at org.activiti.ldap.LDAPTemplate.execute(LDAPTemplate.java:44) ~[activiti-ldap-5.16.4.jar:5.16.4]
   at org.activiti.ldap.LDAPGroupManager.findGroupsByUser(LDAPGroupManager.java:116) ~[activiti-ldap-5.16.4.jar:5.16.4]
   at com.my_company.project.workflow_core.activiti.CustomLdapGroupManager.findGroupsByUser(CustomLdapGroupManager.java:74) ~[workflow-core-1.0.0-SNAPSHOT.jar:na]
   at org.activiti.engine.impl.TaskQueryImpl.getGroupsForCandidateUser(TaskQueryImpl.java:1007) ~[activiti-engine-5.16.4.jar:5.16.4]
   at org.activiti.engine.impl.TaskQueryImpl.getCandidateGroups(TaskQueryImpl.java:997) ~[activiti-engine-5.16.4.jar:5.16.4]
   at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source) ~[na:na]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_75]
   at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_75]
   at org.apache.ibatis.reflection.invoker.MethodInvoker.invoke(MethodInvoker.java:37) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:151) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:45) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:113) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextMap.get(DynamicContext.java:94) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextAccessor.getProperty(DynamicContext.java:113) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1657) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:92) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.ASTChain.getValueBody(ASTChain.java:109) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.ASTGreater.getValueBody(ASTGreater.java:49) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.ASTAnd.getValueBody(ASTAnd.java:56) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:333) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:413) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:395) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:45) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.ExpressionEvaluator.evaluateBoolean(ExpressionEvaluator.java:29) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:30) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:29) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:31) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:29) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.TrimSqlNode.apply(TrimSqlNode.java:51) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:29) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.scripting.xmltags.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:37) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:275) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:79) ~[mybatis-3.2.5.jar:3.2.5]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104) ~[mybatis-3.2.5.jar:3.2.5]
   … 96 common frames omitted


activitiApplicationContext.xml:

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="dataSource" ref="dataSource"/>
    <property name="transactionManager" ref="transactionManager"/>
    <property name="databaseSchemaUpdate" value="true"/>
    <property name="jobExecutorActivate" value="true"/>
    <!– mail server config ommited –>
    <!– pre and postBpmnParseHandlers config ommited –>

    <property name="configurators">
        <list>
            <bean class="com.my_company.project.workflow_core.activiti.CustomLdapConfigurator">
                <property name="server" value="${ldap.EndpointServer.host}"/>
                <property name="port" value="${ldap.EndpointServer.port}"/>
                <property name="user" value="${ldap.EndpointUser}"/>
                <property name="password" value="${ldap.EndpointPassword}"/>

                <property name="baseDn" value="${ldap.BasePath}"/>
                <property name="userBaseDn" value="${ldap.UserBasePath}"/>
                <property name="groupBaseDn" value="${ldap.GroupBasePath}"/>
                <property name="queryUserByUserId" value="(&amp;(objectClass=portalnutzer)(cn={0}))"/>
                <property name="queryGroupsForUser" value="(&amp;(objectClass=nutzergruppe)(member={0}))"/>
                <property name="queryUserByFullNameLike" value="(&amp;(objectClass=inetOrgPerson)(|({0}=*{1}*)({2}=*{3}*)))"/>

                <property name="userIdAttribute" value="cn"/>
                <property name="userFirstNameAttribute" value="cn"/>
                <property name="userLastNameAttribute" value="sn"/>

                <property name="groupIdAttribute" value="cn"/>
                <property name="groupNameAttribute" value="cn"/>
               
                <!– custom repository –>
                <property name="kundenRollenRepository" ref="foerderFallKundenRolleRepositoryImpl"/>
            </bean>
        </list>
    </property>
</bean>



public class CustomLdapConfigurator extends LDAPConfigurator {
    private FoerderFallKundenRolleRepository kundenRollenRepository;

    @Override
    public void configure(ProcessEngineConfigurationImpl processEngineConfiguration) {
        super.configure(processEngineConfiguration);
        Clock clock = processEngineConfiguration.getClock();
        // Replace GroupIdentityManager with own CustomGroupIdentityManager
        CustomLdapGroupManagerFactory groupManagerFactory = new CustomLdapGroupManagerFactory(this, clock,
                kundenRollenRepository, processEngineConfiguration.getRuntimeService());
        processEngineConfiguration.getSessionFactories().put(GroupIdentityManager.class, groupManagerFactory);
    }
   
    //Set custom repository
    public void setKundenRollenRepository(FoerderFallKundenRolleRepository kundenRollenRepository) {
        this.kundenRollenRepository = kundenRollenRepository;
    }
}

public CustomLdapGroupManagerFactory(LDAPConfigurator ldapConfigurator, Clock clock,
                                         FoerderFallKundenRolleRepository kundenRollenRepository,
                                         RuntimeService runtimeService) {
        super(ldapConfigurator, clock);
        this.kundenRollenRepository = kundenRollenRepository;
        this.runtimeService = runtimeService;
    }

    @Override
    public Session openSession() {
        if (ldapGroupCache == null) {
            return new CustomLdapGroupManager(ldapConfigurator, kundenRollenRepository, runtimeService);
        } else {
            return new CustomLdapGroupManager(ldapConfigurator, ldapGroupCache, kundenRollenRepository, runtimeService);
        }
}

Outcomes