jerryfiunam (61) [Avatar] Offline
Hi again smilie,

This time I just would like to know if is possible to get instances of every *Entity classes, for instance "DeploymentEntity" or "ProcessDefinitionEntity" class. I tried to get that with this code:

DeploymentEntity deployment = Context

But Context.getCommandContext() retrieves a NULL object, so I wonder is there is another way to do that, or there is something that I have to do before in order to get it. I know that this is not part of the public API, so I wonder if you can help me with it.

Thanks in advance.

jerryfiunam (61) [Avatar] Offline
Re: How to get instances of *Entity classes
In addition to my former post, I realized that this line of code:


always retrieves NULL, internally this object is always NULL. This time I wanted to build a CustomePostDeployer for my BusinessRules and when I apply this code:


Internally an error occurs as follows:

Caused by: java.lang.NullPointerException at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(
at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(

Which is this line of code in the BpmnDeployer class:

CommandContext commandContext = Context.getCommandContext();
ProcessDefinitionEntityManager processDefinitionManager = commandContext.getProcessDefinitionEntityManager();

I wonder if this is correct, and what can I do in order to avoid this. Is every object retrieved by Context class NULL? Why Context.getCommandContext() is always NULL?

Thanks smilie
tijs.rademakers (494) [Avatar] Offline
Re: How to get instances of *Entity classes

When you check all the service implementations in Activiti you see that it's always wrapped in a command executor. That's needed to have a command context and that's why it's null in your case.

Best regards,

jerryfiunam (61) [Avatar] Offline
Re: How to get instances of *Entity classes
Hi Tijs,

Thanks a lot for your explanation, I will workaround this with another approach smilie.