Vladimir, using setClient can have side effects in concurrent cases e.g. when at the same time new task is created and another is completed. Two threads will use the same LocalTaskService instance which could lead to some unexpected results.
The error you are seeing could be caused by not declared type of you process variables, take a look here at line 14, you'll see it declares String as structureRef so that informs the engine how to deal with that variable.You can declare java.lang.String as FQN too. Once you have that it should proceed with setting variables properly.
HTH