I think that the cause fo the problem is:
Caused by: java.lang.NullPointerException
at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:68)
that indicates you should use command to set the variables, try with following code:
GenericCommand<Void> setProcInstVariablesCommand = new GenericCommand<Void>() {
public Void execute(Context context) {
StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession();
ProcessInstance processInstance = ksession.getProcessInstance(new Long(processInstanceId));
if (processInstance != null) {
VariableScopeInstance variableScope = (VariableScopeInstance)
((org.jbpm.process.instance.ProcessInstance) processInstance)
.getContextInstance(VariableScope.VARIABLE_SCOPE);
if (variableScope == null) {
throw new IllegalArgumentException(
"Could not find variable scope for process instance " + processInstanceId);
}
for (Map.Entry<String, Object> entry: variables.entrySet()) {
variableScope.setVariable(entry.getKey(), entry.getValue());
}
} else {
throw new IllegalArgumentException("Could not find process instance " + processInstanceId);
}
return null;
}
};
ksession.execute(setProcInstVariablesCommand);
HTH