AnsweredAssumed Answered

Injecting a Service in a TaskListener returns Null

Question asked by artemas on Nov 7, 2016
Latest reply on May 17, 2018 by
I have a TaskListener assigned to a task in my Activiti Workflow. The issue I'm having is injecting a Service as it returns null when I try to access methods in that Service. The Class below is located in my extension at:

package com.custom.bpmn.listner;

import com.activiti.service.api.UserService;

public class TestListener implements TaskListener {

   private static final long serialVersionUID = 1L;
    private static final Logger logger = LoggerFactory.getLogger(TestListener.class);

    private UserService userService;

   public void notify(DelegateTask delegateTask) {

      long userId = new Long((String)delegateTask.getVariable("currentUser")).longValue();
      String previousAssignee = userService.findUser(userId).getExternalId();


Each time I try to access the UserService, it's always null and returning a
Null Pointer Exception
although the userId exists.