ClassCastException when setting Async Listener on EJB Executor

Solution Verified - Updated -


  • We are using jBPM in embedded mode and trying to use Executor component as EJB. Is it possible to set Listener on executor, when it's used as EJB? We tried it but it failed with ClassCastException.


package sample;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ejb.Singleton;
import javax.ejb.Startup;

import org.jbpm.executor.impl.ExecutorServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import sample.MyAsyncJobListener;

public class StartupBean {

    private static final Logger logger = LoggerFactory.getLogger(StartupBean.class);

    DeploymentServiceEJBLocal deploymentService;

    ExecutorServiceEJB executorService;

    public void init() throws Exception {

        // init executor after kjar deployment
        if (!executorService.isActive()) {
            System.out.println(" ====== starting the custom executor ===== ");
            System.setProperty("org.kie.executor.disabled", "false");

        // this command throw a ClassCastException...
        ((ExecutorServiceImpl) executorService).addAsyncJobListener(new MyAsyncJobListener());


Caused by: java.lang.ClassCastException:$$$view1 cannot be cast to org.jbpm.executor.impl.ExecutorServiceImpl


  • Red Hat JBoss BPM Suite
    • 6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In