Query DeploymentEntity throw NullPointerException

hi:
When my code runs to :

 ProcessDefinition pde = org.flowable.engine.impl.util.ProcessDefinitionUtil.getProcessDefinition(task.getProcessDefinitionId());

 or

 DeploymentEntity deploymentEntity = org.flowable.engine.impl.util.CommandContextUtil.getProcessEngineConfiguration()
            .getDeploymentEntityManager().findById(processDefinitionEntity.getDeploymentId());

Always throw NullPointerException exceptions ,why? These Util tool classes is not supported like that?

then i Modify code like this:

DeploymentEntityManager dem = processEngineConfiguration.getDeploymentEntityManager();
DeploymentEntity deployment = dem.findById(pde.getDeploymentId());

Still throw an exception,in debug mode ,i find in class Context.class method getCommandContext() is null!
please How do I operate it?

Best regards
zhiyin

Hi Zhiyin,

manager’s findById can be used only in the command context (see usages).
Use repository service to query for deployments by id.

Regards
Martin

hi martin.grofcik,
I found other ways to solve my problem. Thank you very much for your advice!

Best regards
zhiyin