Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix creating processEngine with instance of ProcessEngineConfigurationIm... #519

Merged
merged 1 commit into from
Feb 18, 2015

Conversation

kotslon
Copy link
Contributor

@kotslon kotslon commented Feb 17, 2015

I get an error trying to create engine bean using an instance of org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration, which is a descendant of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl, but has no transaction manager unlike org.activiti.spring.SpringProcessEngineConfiguration.

An error occurs in org.activiti.spring.ProcessEngineFactoryBean when it tries to cast configuration bean to org.activiti.spring.SpringProcessEngineConfiguration:

Caused by: java.lang.ClassCastException: org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration cannot be cast to org.activiti.spring.SpringProcessEngineConfiguration
at org.activiti.spring.ProcessEngineFactoryBean.configureExternallyManagedTransactions(ProcessEngineFactoryBean.java:72)

The same code works on previous versions of Activiti bacause of the appropriate type checking:

public class ProcessEngineFactoryBean implements FactoryBean<ProcessEngine>, DisposableBean, ApplicationContextAware {
    // ...
    protected void initializeTransactionExternallyManaged() {
        if (processEngineConfiguration instanceof SpringProcessEngineConfiguration) { // remark: any config can be injected, so we cannot have SpringConfiguration as member
            SpringProcessEngineConfiguration engineConfiguration = (SpringProcessEngineConfiguration) processEngineConfiguration;
            if (engineConfiguration.getTransactionManager() != null) {
                processEngineConfiguration.setTransactionsExternallyManaged(true);
            }
        }
    }
    // ...
}

I hope, that check was not deleted intentionally, but removed accidently during refactoring here when initializeTransactionExternallyManaged() was renamed to configureExternallyManagedTransactions().

So, I want it to be there, to be able to use any ProcessEngineConfigurationImpl (StandaloneProcessEngineConfiguration in my case).

jbarrez added a commit that referenced this pull request Feb 18, 2015
fix creating processEngine with instance of ProcessEngineConfigurationIm...
@jbarrez jbarrez merged commit 0a81c7e into Activiti:master Feb 18, 2015
@jbarrez
Copy link
Contributor

jbarrez commented Feb 18, 2015

Valid point. That shouldn't have gone through.

Thanks for fixing it!

@ftanil
Copy link

ftanil commented Feb 20, 2015

Does activiti releases minor versions or do we need to (officially) wait for the 5.18.0 for this fix? (By the way, I know I can get the sources from here and build myself, but that's not an option to use that for our current build process)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants