How to get the elementType of a ModelInstanceElement that is not a FlowElement (Transaction)?

I am dynamically registering Executionlisteners to process-elements (camunda-bpm-reactor, but would also apply to camunda-engine-cdi).

Now when dealing with an “Transaction” element, I get a CCE when getting the elementTypename, because internal camunda code already assumes it is a FlowElement, which it is not:

see BpmnModelExecutionContext#getBpmnModelElementInstance -> internal cast to FlowElement.

How can I do this:

static String extractTypeName(DelegateExecution bpmnModelExecutionContext) {
  ModelElementInstance bpmnModelElementInstance = bpmnModelExecutionContext.getBpmnModelElementInstance();
  return bpmnModelElementInstance.getElementType().getTypeName();

when the executionListener is bound to a Transaction element?

Bug and test case:

Hi Jan,

Transaction extends the FlowElement interface, see the type hierarchy:

Can you debug why this is failing? Could this be a classloading issue (e.g. class is twice on classpath, loaded by different classloaders)?


Oh, I see. We built proper parsing of transactions only with 7.5.0 in the model API (see
I therefore suggest you upgrade the reactor extension to 7.5.0 or ignore transactions for the time being.


Ah … ok, I see.

I have to think about how I want to deal with 7.4/7.5 in the extension … do not want to support both and its a bit early to drop 7.4 … But that explains it.