Hi,I've a process definition which is consisting of service tasks so there is no wait state in it. After calling
startProcessInstanceByKey(processDefinitionKey, map);
process starts, ends and return. After returning, I'm trying to access a variable which I gave in the map parameter. The parameter I'm trying to access is a custom object implementing Serializable interface. I use that query:
NativeHistoricVariableInstanceQuery historicVariableInstanceQuery = historyService.createNativeHistoricVariableInstanceQuery();
historicVariableInstanceQuery.sql("SELECT * FROM " + managementService.getTableName(HistoricVariableInstance.class) +
" WHERE EXECUTION_ID_=#{executionId} AND NAME_=#{variableName}");
historicVariableInstanceQuery.parameter("executionId", executionId);
historicVariableInstanceQuery.parameter("variableName", variableName);
HistoricVariableInstance historicVariableInstance = historicVariableInstanceQuery.singleResult();
if (historicVariableInstance != null) {
return (T) historicVariableInstance.getValue();
}
return null;
At the line return (T) historicVariableInstance.getValue();
(SimpleActivitiQueryService.java:65) I get a NPE:
java.lang.NullPointerException
at org.activiti.engine.impl.persistence.entity.ByteArrayRef.ensureInitialized(ByteArrayRef.java:93)
at org.activiti.engine.impl.persistence.entity.ByteArrayRef.getBytes(ByteArrayRef.java:46)
at org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.getBytes(HistoricVariableInstanceEntity.java:123)
at org.activiti.engine.impl.variable.ByteArrayType.getValue(ByteArrayType.java:32)
at org.activiti.engine.impl.variable.SerializableType.getValue(SerializableType.java:51)
at org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.getValue(HistoricVariableInstanceEntity.java:114)
at myPkg.SimpleActivitiQueryService.findLastValueOfVariable(SimpleActivitiQueryService.java:65)
It seems that at ByteArrayRef.java:93
, Context.getCommandContext()
is null.I've seen some possibly related links but I'm not sure if they about this issue or not:Thanks.