ProcessEngineException: Unknown property used in expression: ${myStartExecutionListener}. Cause: Cannot resolve identifier 'myStartExecutionListener'

In my EjbProcessApplication I am using the default process engine with
processEngine = ProcessEngines.getDefaultProcessEngine(); an handle the deployment of my BPMN like this:

return processEngine.getRepositoryService()
                .createDeployment()
                .addClasspathResource(deploymentSource)
                .source(deploymentSource)
                .name(deploymentName)
                .enableDuplicateFiltering(deployChangedOnly) // deploy nur bei Änderung
                .deployWithResult();

This works as expected.

In my BPMN Model I have some listeners for a UserTask. All class listeners work also as expected. Only the delege listener results in a ProcessEngineException.

ENGINE-16004 Exception while closing command context: Unknown property used in expression: ${myStartExecutionListener}. Cause: Cannot resolve identifier 'myStartExecutionListener': org.camunda.bpm.engine.ProcessEngineException: Unknown property used in expression: ${myStartExecutionListener}. Cause: Cannot resolve identifier 'myStartExecutionListener'

This is my camunda.cfg.xml

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="processEngineConfiguration" class="org.camunda.bpm.engine.impl.cfg.JtaProcessEngineConfiguration">
        <property name="databaseSchemaUpdate" value="false" />
        <property name="dataSourceJndiName" value="java:jboss/jdbc/Mis2DB" />
        <property name="transactionManagerJndiName" value="java:jboss/TransactionManager" />

        <property name="idGenerator">
            <bean class="org.camunda.bpm.engine.impl.persistence.StrongUuidGenerator" />
        </property>

        <property name="metricsEnabled" value="false"/>
        <property name="dbMetricsReporterActivate" value="false" />
    </bean>
</beans>

This is a snippet from my model:

<bpmn:userTask id="t_AnfrageErfassen" name="Anfrage erfassen">
      <bpmn:extensionElements>
        <camunda:executionListener delegateExpression="${myStartExecutionListener}" event="start" />
        <camunda:executionListener class="at.luxbau.mis2.bpm.listener.MyEndExecutionListener" event="end" />
        <camunda:taskListener class="at.luxbau.mis2.bpm.listener.MyCreateTaskListener" event="create" />
        <camunda:taskListener class="at.luxbau.mis2.bpm.listener.MyCompleteTaskListener" event="complete" />
      </bpmn:extensionElements>

This is my delegate expression listener:

@Named
public class MyStartExecutionListener implements ExecutionListener {

    private final Logger LOGGER = Logger.getLogger(MyStartExecutionListener.class.getName());

    @Override
    public void notify(DelegateExecution execution) throws Exception {
        LOGGER.info("+".repeat(80));
        LOGGER.info(String.format("-> %s#notify()", getClass().getName()));

        LOGGER.info(String.format("<- %s#notify()", getClass().getName()));
        LOGGER.info("-".repeat(80));
    }
}

and this is my class listener:

public class MyCreateTaskListener implements TaskListener {

    private final Logger LOGGER = Logger.getLogger(MyCreateTaskListener.class.getName());

    @Override
    public void notify(DelegateTask delegateTask) {
        LOGGER.info("+".repeat(80));
        LOGGER.info(String.format("-> %s#notify()", getClass().getName()));

        LOGGER.info(String.format("<- %s#notify()", getClass().getName()));
        LOGGER.info("-".repeat(80));
    }
}

How can I get the delegate listener working? In this context it is just a proof-of-concept, later i will use a delegate expression in some service tasks, where I need CDI Injection!

Thank you and regards,
Rainer

Can you also upload your model?

Here is my model:

mis2_processes.bpmn (31.1 KB)

Can you describe the outline of the project and how you do deployments?

The project manages the whole life-cycle of our construction company projects, starting form the first contact (inquiry = Anfrage), to offers and orders.
We deploy 2 WAR archives to a WildFly application server, where 1 archive is the backend - containing the BPM stuff - and the 2 archive is the Web UI part.

Are you able to confirm the java class you’re trying to call is present in the same WAR file as the model?

Here a screenshot of my war structure:

What are the exact requirements for Java Code called through delegate expressions? And when to use ${expression} or #{expression} ?!

Is it allowed to have the model in the war archive and the delegate classes in a separate jar archive which is packed into the war?

Yes, the called java class is in the same WAR as the model!

It seems there is a difference in the kind of deployment!

When calling ProcessEngine.deploy() with property isScanForProcessDefinitions = true the bpmn model is automatically deployed and a message like registered for DB deployments [...]. Will execute process definitions is in the log. Also the @PostDeploy method shows the injected process engine. With this setup the delegate classes are called correctly!

When calling ProcessEngine.deploy() with property isScanForProcessDefinitions = false the bpmn model is not automatically deployed and in the log I have a message like Not creating a deployment for process archive 'EjbCamundaBpmProcessApplication': no resources provided. In this case I deploy the model as mentioned above with

processEngine.getRepositoryService()
                 .createDeployment()
                 .addClasspathResource(deploymentSource)
                 .source(deploymentSource)
                 .name(deploymentName)
                 .enableDuplicateFiltering(deployChangedOnly) // deploy nur bei Änderung
                 .deployWithResult();

and the log reports 1 process definitions deployed. But in this case I get the error

ENGINE-16004 Exception while closing command context: Unknown property used in expression: ${startExecutionListener}. Cause: Cannot resolve identifier 'startExecutionListener': org.camunda.bpm.engine.ProcessEngineException: Unknown property used in expression: ${startExecutionListener}. Cause: Cannot resolve identifier 'startExecutionListener'
	at deployment.lumin-ol.war//org.camunda.bpm.engine.impl.el.JuelExpression.getValue(JuelExpression.java:63)

So for me there must be a difference in the way of how to deploy the model!

Any ideas how to solve this deployment issue?

Thank you!