I'm working with version 5.9 of the code of Activiti, the error showed when I tried to delete a historical record by ID.
fix it by adding the lines
<delete id="deleteHistoricActivityInstance">
delete from ACT_HI_ACTINST where ID_ = #{id}
</delete>
after
<delete id="deleteHistoricActivityInstancesByProcessInstanceId">
delete from ACT_HI_ACTINST where PROC_INST_ID_ = #{processInstanceId}
</delete>
like I said.
After modifying the file HistoricActivityInstance.xml, I generate the distribution again, start the environment and it works.
But, if you´re modifying the activiti-engine.jar, I recommended turning off the environment, modify the jar and start the environment
Hope this help