Hi There,
i have just quick question: If I have own process application (shared process engine) with processes.xml and applicationContext.xml, should I have BPM files included in this war file? If the bpmn file has been saved into deployment table, means, that resource name XXX.bpm and source = process application, says where the bpmn file is located on local drive? Other words, bpmn file, which is deployed into DB , is not saved as blob, just reference on this file is saved, right?
Then resolver is called and class loader is called too and my beans are loaded. If XXX.bpm file is not part of the war file, then no beans are loaded and error is shown like “Not property found: testService” ,for example.
I debugged source code i see how it works, but my boss still cannot understand, why bpmn file should be in war file, why is not loaded from DB.
Process models are indeed persisted as BLOBs in the database (check the table ACT_GE_BYTEARRAY). Once deployed, the process engine only loads the BPMN files from there.
Why is the process engine not able to resolve beans, etc. when executing a process? The process engine maintains a registry mapping deployments to process applications. If the registry does not contain an entry for a certain deployment, then the process engine is not be able to resolve resources from a process application for it. APIs related to that are ManagementService#registerProcessApplication and ManagementService#unregisterProcessApplication.
Now, why does your process application need to contain the BPMN files in order for bean resolution to work, when you have already deployed them before? In general, it does not have to. However, then the process engine cannot automatically maintain the registry of which deployment is complemented by which process application. If the models are included in the process application, then the process engine determines during application deployment that there is already an existing process deployment for these models and registers the process application automatically.
In essence, if you want your process application to be registered for existing deployments, either include those BPMN resources in the application to trigger automatic registration or register the process application manually by using ManagementService#registerProcessApplication.
Hi Thorben,
i see, thanks for clarifying, but just additional question, what does it mean, to run manually ManagementService#unregisterProcessApplication. How can i do this and where? It needs deploymentID:
You can obtain a deployment IDs by making a deployment query (RepositoryService#createDeploymentQuery). You have to provide the logic to decide which is the correct deployment yourself.
You can obtain an instance of ProcessApplicationReference via ProcessApplicationInterface#getReference. ProcessApplicationInterface is implemented by all process application classes. E.g. you can obtain the reference in an @PostDeploy method of your process application.