AnsweredAssumed Answered

Injecting UserService yields Null

Question asked by abbask on May 9, 2016
Latest reply on May 9, 2016 by abbask
Hello,

i am trying to inject UserService but it throws NullPointerException when i try to use it.

@Component("createUser")
public class CreateUser implements JavaDelegate{
   private static final Logger LOG = LoggerFactory.getLogger(CreateUser.class);
   //inject user service and group service
   @Autowired
   private UserService userService;
      
   @Autowired
   private GroupService groupService;
   
   public void execute(DelegateExecution execution) throws Exception {
      
      //get process variables
      String userName = (String) execution.getVariable("userName");
      String userEmail = (String) execution.getVariable("userEmail");
      Long userId = (Long) execution.getVariable("userId");
      
      System.out.println(userService + "<<<>>>" + groupService);
      LOG.info(userService + " is userService object");
      //create new user
      User user = userService.createNewUser(userEmail, userName, "", userId.toString(), "TCS", UserStatus.ACTIVE, AccountType.ENTERPRISE, userId);
      userService.save(user);
   }
}

gives null pointer exception at userService.createNewUser(..)


thanks in advance

Outcomes