I tried to reproduce this issue so I added a testcase to
org.jbpm.examples.subprocess.outcomeactivity.SubProcessOutcomeActivityTest
but the following testcase passed for me:
public void testSubProcessIdQuery() {
ProcessInstance processInstance = executionService.startProcessInstanceByKey("SubProcessDocument");
final Execution execution = processInstance.findActiveExecutionIn("review");
assertNotNull(execution);
assertNotNull(processEngine);
String pid = ((ExecutionImpl) execution).getSubProcessInstance().getId();
assertNotNull(pid);
List<Task> taskList = taskService.findPersonalTasks("johndoe");
Task task = taskList.get(0);
taskService.completeTask(task.getId(), "reject");
}
so maybe if you post your testcase someone is able to shed some light on this