I answer to my own question. In my code, to avoid to dipose the session "manually", I manage the afterProcessCompleted event:
public void afterProcessCompleted(ProcessCompletedEvent event)
{
// Dispose the session.
// Commented with JBPM 5.2
((StatefulKnowledgeSession) event.getKnowledgeRuntime()).dispose();
}
That turns to null the session.
With JBPM 5.2, after the process is completed, the InternalKnowledgeRuntime.endOperation is executed, soi a NPE is thrown.