AnsweredAssumed Answered

NullPointer Exception for LDAP Integration based on Apache Directory

Question asked by jonnycarter on May 28, 2013
Latest reply on May 29, 2013 by jbarrez
I've applied the custom LDAP integration detailed in Chapter 10 of Activiti in Action (https://code.google.com/p/activitiinaction/). Because I'm trying to use it into Activiti 5.12, I changed the LDAPUserManager class to extend UserEntityManager, and the LDAPGroupManager class to extend GroupEntityManager.

The short version is, having done that, I cannot login.

I'm getting a NullPointerException from the org.activiti.explorer.ui.login.DefaultLoginHandler.authenticate() method.
Here's the XML I've put into the activiti-standalone-context.xml (some property values obfuscated):
<blockcode>
   <property name="customSessionFactories">
     <list>
      <bean class="com.enterprise.ldap.LDAPUserManagerFactory">
        <constructor-arg ref="ldapConnectionParams" />
      </bean>
      <bean class="com.enterprise.ldap.LDAPGroupManagerFactory">
        <constructor-arg ref="ldapConnectionParams" />
      </bean>
     </list>
   </property>
 
  </bean>
 
  <bean id="ldapConnectionParams" class="com.enterprise.ldap.LDAPConnectionParams">
   <property name="ldapServer" value="ldapServer.enterprise.com" />
   <property name="ldapPort" value="####" />
   <property name="ldapUser" value="cn=serviceAccount,ou=folder1,ou=folder2,ou=folder3,dc=my,dc=company,dc=domain" />
   <property name="ldapPassword" value="somePasswordHere" />
  </bean>
</blockcode>

Here's the stack trace I'm receiving when I try to login using LDAP credentials:
<blockcode>
May 23, 2013 1:10:47 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Vaadin Application Servlet] in context with path [/activiti-explorer] threw exception [com.vaadin.event.ListenerMethod$MethodException: Invocation of method onLogin in org.activiti.explorer.ui.login.LoginPage$ActivitiLoginListener failed.] with root cause
java.lang.NullPointerException
   at org.activiti.explorer.ui.login.DefaultLoginHandler.authenticate(DefaultLoginHandler.java:40)
   at org.activiti.explorer.ui.login.DefaultLoginHandler.authenticate(DefaultLoginHandler.java:34)
   at org.activiti.explorer.ui.login.LoginPage$ActivitiLoginListener.onLogin(LoginPage.java:98)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
   at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
   at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
   at com.vaadin.ui.LoginForm$2.handleParameters(LoginForm.java:103)
   at com.vaadin.ui.Window.handleParameters(Window.java:515)
   at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:528)
   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.activiti.explorer.filter.ExplorerFilter.doFilter(ExplorerFilter.java:44)
   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:472)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)
</blockcode>

Given where the error is occurring ([yrl=https://github.com/Activiti/Activiti/blob/3bf619688fb13874520ec937c719f7833b11de89/modules/activiti-explorer/src/main/java/org/activiti/explorer/ui/login/DefaultLoginHandler.java#L40]line 40 of the DefaultLoginHandler), I'm wondering if the identityService is null for some reason?

Any tips on tracking that down and fixing the issue?

Outcomes