cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti REST-LDAP integration broken in 5.15.1

b_schnarr
Champ in-the-making
Champ in-the-making
Hello at all,

I configured Activiti 5.14 REST-Webapp with the following LDAP-Parameters and everything worked perfectly fine:


<property name="configurators">
          <list>
              <bean class="org.activiti.ldap.LDAPConfigurator">
             
                <!– Server connection params –>
                <property name="server" value="ldap://****" />
                <property name="port" value="389" />
                <property name="user" value="cn=Administrator,cn=Users,dc=ebusiness,dc=local" />
                <property name="password" value="****" />
               
                <!– Query params –>
                <property name="baseDn" value="ou=ebusiness,dc=ebusiness,dc=local" />
                <property name="queryUserByUserId" value="(&amp;(objectClass=person)(cn={0}))" />
                <property name="queryUserByFullNameLike" value="(&amp;(objectClass=person)(|({0}=*{1}*)({2}=*{3}*)))" />
                <property name="queryGroupsForUser" value="(&amp;(objectClass=group)(member={0}))" />
               
                <!– Only for Active Directories –>
                <property name="customConnectionParameters">
                <map>
                <entry key="InitialDirContext" value="Context.REFERRAL" />
                </map>
                </property>
               
                <!– Attribute config –>
                <property name="userIdAttribute" value="cn" />
                <property name="userFirstNameAttribute" value="givenName" />
                <property name="userLastNameAttribute" value="sn" />
               
                <property name="groupIdAttribute" value="cn" />
                <property name="groupNameAttribute" value="cn" />
               
              </bean>
          </list>
        </property>


Basic-Authentication worked fine. Now, I downloaded the 5.15.1 version and did a clean install (no upgrade). I configured the Rest-Webapp exactly the same way. When I test the REST-App with a REST-Plugin, the REST-API asks for my credentials (exactly as in 5.14) but instad of getting a 200 status code afterwoods, I get a 500 internal server error with this log:


Mai 20, 2014 3:09:48 PM org.restlet.resource.ServerResource doCatch
Warnung: Exception or error caught in server resource
Internal Server Error (500) - The server encountered an unexpected condition which prevented it from fulfilling the request
   at org.restlet.resource.ServerResource.doHandle(ServerResource.java:517)
   at org.restlet.resource.ServerResource.get(ServerResource.java:707)
   at org.restlet.resource.ServerResource.doHandle(ServerResource.java:589)
   at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:649)
   at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:348)
   at org.restlet.resource.ServerResource.handle(ServerResource.java:952)
   at org.restlet.resource.Finder.handle(Finder.java:246)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Router.doHandle(Router.java:431)
   at org.restlet.routing.Router.handle(Router.java:648)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)
   at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:84)
   at org.restlet.Application.handle(Application.java:381)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Router.doHandle(Router.java:431)
   at org.restlet.routing.Router.handle(Router.java:648)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Router.doHandle(Router.java:431)
   at org.restlet.routing.Router.handle(Router.java:648)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)
   at org.restlet.Component.handle(Component.java:392)
   at org.restlet.Server.handle(Server.java:516)
   at org.restlet.engine.ServerHelper.handle(ServerHelper.java:72)
   at org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:152)
   at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1089)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
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)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)
   at org.activiti.engine.impl.db.DbSqlSession.selectListWithRawParameter(DbSqlSession.java:331)
   at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:322)
   at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:312)
   at org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntityManager.findProcessDefinitionsByQueryCriteria(ProcessDefinitionEntityManager.java:57)
   at org.activiti.engine.impl.ProcessDefinitionQueryImpl.executeList(ProcessDefinitionQueryImpl.java:288)
   at org.activiti.engine.impl.AbstractQuery.execute(AbstractQuery.java:143)
   at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
   at org.activiti.engine.impl.AbstractQuery.listPage(AbstractQuery.java:124)
   at org.activiti.rest.common.api.AbstractPaginateList.paginateList(AbstractPaginateList.java:104)
   at org.activiti.rest.common.api.AbstractPaginateList.paginateList(AbstractPaginateList.java:129)
   at org.activiti.rest.service.api.repository.ProcessDefinitionCollectionResource.getProcessDefinitions(ProcessDefinitionCollectionResource.java:107)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.restlet.resource.ServerResource.doHandle(ServerResource.java:506)
   … 62 more
Caused by: java.lang.NullPointerException
   at javax.naming.ldap.Rdn.escapeStringValue(Unknown Source)
   at javax.naming.ldap.Rdn.escapeValue(Unknown Source)
   at org.activiti.ldap.LDAPQueryBuilder.buildQueryGroupsForUser(LDAPQueryBuilder.java:77)
   at org.activiti.ldap.LDAPGroupManager$1.executeInContext(LDAPGroupManager.java:120)
   at org.activiti.ldap.LDAPGroupManager$1.executeInContext(LDAPGroupManager.java:116)
   at org.activiti.ldap.LDAPTemplate.execute(LDAPTemplate.java:44)
   at org.activiti.ldap.LDAPGroupManager.findGroupsByUser(LDAPGroupManager.java:116)
   at org.activiti.engine.impl.ProcessDefinitionQueryImpl.getAuthorizationGroups(ProcessDefinitionQueryImpl.java:234)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.ibatis.reflection.invoker.MethodInvoker.invoke(MethodInvoker.java:37)
   at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:151)
   at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:45)
   at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:113)
   at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextMap.get(DynamicContext.java:94)
   at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextAccessor.getProperty(DynamicContext.java:113)
   at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1657)
   at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:92)
   at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
   at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210)
   at org.apache.ibatis.ognl.ASTNotEq.getValueBody(ASTNotEq.java:49)
   at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
   at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210)
   at org.apache.ibatis.ognl.ASTAnd.getValueBody(ASTAnd.java:56)
   at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
   at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210)
   at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:333)
   at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:413)
   at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:395)
   at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:45)
   at org.apache.ibatis.scripting.xmltags.ExpressionEvaluator.evaluateBoolean(ExpressionEvaluator.java:29)
   at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:30)
   at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:29)
   at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:31)
   at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:29)
   at org.apache.ibatis.scripting.xmltags.TrimSqlNode.apply(TrimSqlNode.java:51)
   at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:29)
   at org.apache.ibatis.scripting.xmltags.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:37)
   at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:275)
   at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:79)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)
   … 86 more


I used this test-query: http://***:8080/activiti-rest/service/repository/process-definitions?startableByUser=gonzo
and I did not altered the source code. Then, I tried 5.14 again, everything is fine.


For me, this is a showstopper bug. Please, could anyone can confirm this problem?

Best regards
Ben
9 REPLIES 9

jbarrez
Star Contributor
Star Contributor
It seems to be related to MyBatis

org.apache.ibatis.scripting.xmltags.ExpressionEvaluator.evaluateBoolean(ExpressionEvaluator.java:29)

Do you have any other versions of MyBatis on your classpath?

b_schnarr
Champ in-the-making
Champ in-the-making
I did not change anything. I downloaded the new war-file from activiti.org and deployed it. Then I got this error. Deleting 5.15-war and deploying 5.14-war, all worked Fine.

Therefore, this should be reproducable

jbarrez
Star Contributor
Star Contributor
> Therefore, this should be reproducable

That is why I asked what is going in. It is reproducable in your case. Remember, we've got unit tests for this, and we don't have failures. So it must be something that goes in on your side that makes it fail. Which is not tested in the unit test.

The error seems to be happening on the line that was changed in 5.15:
https://github.com/Activiti/Activiti/commit/691b8ef0953cac4381ec95a8269182cf0ccaccf7

It seems that the Rdn.escapeValue is not doing what it should do for you?

b_schnarr
Champ in-the-making
Champ in-the-making
Yes, indeed. I also saw this line. But I do not have enough skills to figure out what is wrong. But this does not seem to be the root cause because with this line
<code> searchExpression = MessageFormat.format(ldapConfigurator.getQueryGroupsForUser(), Rdn.escapeValue(userDn));</code>
everything works fine (I switched back to a snapshot build)

jbarrez
Star Contributor
Star Contributor
Hmmm interesting. So it indeed must be something different.

Which snapshot build did you use? Maybe we can pinpoint the wrong code line in the period between the snapshot build and the release?

b_schnarr
Champ in-the-making
Champ in-the-making
I checked out a Snapshot release on the 27th febuary 2014. This version works. With the newest wars, I get this error.

jbarrez
Star Contributor
Star Contributor
I have looked at the history from 27/02 - release date, but the Rdn addition is the only change in the LDAP module.

The error is really happening in that line:

Caused by: java.lang.NullPointerException
at javax.naming.ldap.Rdn.escapeStringValue(Unknown Source)
at javax.naming.ldap.Rdn.escapeValue(Unknown Source)
at org.activiti.ldap.LDAPQueryBuilder.buildQueryGroupsForUser(LDAPQueryBuilder.java:77)

Also, the 'rdn fix' has been made 6/03 (see https://github.com/Activiti/Activiti/commit/691b8ef0953cac4381ec95a8269182cf0ccaccf7), which wouldn't be in the snapshot release of 27 february.

So again, I'm really interested in the 'userDn', which is fed into the following line where it breaks

searchExpression = MessageFormat.format(ldapConfigurator.getQueryGroupsForUser(), Rdn.escapeValue(userDn));

b_schnarr
Champ in-the-making
Champ in-the-making
Ok, but how can I contribute to solve this? I have no idea how I can debug the whole application?

jbarrez
Star Contributor
Star Contributor
You debug the app like any java webapp: add the JVM opts to have Eclipse remote debugging

Xdebug -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

have the code of Explorer in Eclipse, and put a breakpoint there. Execute the logic that fails, and see the userDn in the variables list.