Plugin for ProcessEngineConfiguration doesn't work

I’m trying to add listener to all user tasks. So I’ve decided to create a plugin using this example. But my plugin never gets called and so my listener. What am I missing?


public class ListenerPlugin extends AbstractProcessEnginePlugin {

    public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
        System.out.println("ListenerPlugin: Adding custom parse listener");
        // init custom bpmn parsers
        List<BpmnParseListener> parseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners();
        if (parseListeners == null) {
            parseListeners = new ArrayList<>();
        parseListeners.add(new BpmnParseParser());

Parse listener:

public class BpmnParseParser extends AbstractBpmnParseListener {
    public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
        System.out.println("BpmnParseParser: Adding listener to user task");
        activity.addListener(TaskListener.EVENTNAME_CREATE, new GlobalUserTaskListener());


public class GlobalUserTaskListener implements ExecutionListener {
    public void notify(DelegateExecution execution) {
        System.out.println("GlobalUserTaskListener: processInstanceId = '" + execution.getProcessInstanceId() + "'");


<!-- bind the process engine service as Spring Bean -->
<bean name="processEngineService" class="org.camunda.bpm.BpmPlatform" factory-method="getProcessEngineService"/>

<!-- bind the default process engine as Spring Bean -->
<bean name="processEngine" factory-bean="processEngineService" factory-method="getDefaultProcessEngine"/>

<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService"/>
<bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService"/>
<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"/>
<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>
<bean id="managementService" factory-bean="processEngine" factory-method="getManagementService"/>

<bean id="processEngineConfiguration"
      factory-bean="processEngine" factory-method="getProcessEngineConfiguration">
    <property name="processEnginePlugins">
            <bean class="" />

<!-- bootstrap the process application -->
<bean id='myProcessApplication'

You register the listener for the event TaskListener.EVENTNAME_CREATE. It should be ExecutionListener.EVENTNAME_START (or any of the others) instead.


Thanks for noting, but this is not the issue because none of the preceding messages appear in console, so it never even tries to register my listener. But anyway I’ve changed TaskListener.EVENTNAME_CREATE to ExecutionListener.EVENTNAME_START and it didn’t change anything

What is your setup, i.e. application server, shared or embedded process engine?

Apache Tomcat Version 8.0.32, shared process engine

Okay, in that case you must register process engine plugins in the bpm-platform.xml configuration file, similar to The reason is that in your applicationContext.xml, you register the plugin after the engine has been created and this has no effect. By registering the plugin in bpm-platform.xml, the plugin is registered before the engine is built. Note that on Tomcat, this requires the plugin class to be accessible from the classloader that loads the ProcessEngine class (i.e. it is required to put the plugin jar in Tomcat’s lib folder).


OK, thanks! I’ll try, though it’s not very convenient as I’ll have to create data source there too (listener should write to database) and this will be a separate project which is not convenient too.
Actually at first I tried to use ProcessApplicationEventListenerPlugin for this task and it worked fine for about a day (except for the fact that the listener was called for every task not just user), but then process began to freeze at the start just like in this topic. Unfortunately I couldn’t find an answer how to fix it (the topic didn’t help), so I’ve decided to try the way with parse listener.

I’ve tried your solution and it works fine. Thanks!