AnsweredAssumed Answered

java.lang.ClassCastException: StandaloneInMemProcessEngineConfiguration cannot be cast to org.activiti.spring.SpringProcessEngin

Question asked by olegv on Feb 17, 2015
Latest reply on Feb 18, 2015 by olegv
I am using org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration to instantiate processEngineConfiguration bean for unit testing purposes. But after upgrade to activiti 5.17.0 i got the ClassCastException.

Here is my activiti.cfg.xml


    <bean name="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration" />
    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
        <property name="processEngineConfiguration" ref="processEngineConfiguration" />
    </bean>


Seems like in activiti-spring sources there used to be a condition


    ProcessEngineFactoryBean.java
        if (processEngineConfiguration instanceof SpringProcessEngineConfiguration) { // remark: any config can be injected, so we cannot have SpringConfiguration as member
            SpringProcessEngineConfiguration engineConfiguration = (SpringProcessEngineConfiguration) processEngineConfiguration;


But now the configuration is always cast

QUESTION: Is there a valid way to instantiate the in memory configuration with StandaloneInMemProcessEngineConfiguration?

Outcomes