Activiti Process Configuration始终指向H2

时间:2016-03-28 10:14:32

标签: java activiti

我正在尝试从activiti.cfg.xml中读取Process Engine,我在其中配置了DB2并设置了数据源。但在调试期间,我可以看到Process配置仍然是H2。此外,在尝试从运行时间服务创建流程实例时,它会变为空。以下是代码

ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml", "processEngineConfiguration")


<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="databaseType" value="db2" />
    <property name="dataSource" ref="customDataSource" />
 </bean>
 <bean id="dataSourceTarget" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="XXX"></property>

<bean id="customDataSource" class="XXX">
    <property name="targetDataSource"><ref local="dataSourceTarget"/></property>
    <property name="schemaName"><value>XXX</value></property>
</bean>


            RuntimeService runtimeService = processEngine.getRuntimeService();
        processInstance = runtimeService.startProcessInstanceByKey(processDefinitionName, processVariablesMap);

如何将配置更改为DB2并获取Process Instance?

3 个答案:

答案 0 :(得分:1)

我认为你错过了ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml", "processEngineConfiguration")

的电话
ERROR Stripe::InvalidRequestError: Invalid token id: tok_18879VHs1bT44hDtvyLbWjOk

而不是

var addr = 'Langstrasse 120, Zürich';
var myA = addr.split(/(\d+)/g);

答案 1 :(得分:0)

您需要更改activiti.properties文件中的数据库属性注释H2配置并指定您自己的数据库配置。这是针对activiti企业...从您的代码中看来您正在使用社区,然后尝试创建独立的流程引擎而不是使用.xml文件......

答案 2 :(得分:0)

如果您尝试在扩展JavaDelegate的类中创建运行时,那么它比这更简单。您需要新进程来继承以前的运行时属性。

所以不要做

   RuntimeService runtimeService = processEngine.getRuntimeService();

您可以获得实际的执行运行时间:

public class CreateNewInstance implements JavaDelegate {

    private String processKey;
    private Map<String, Object> variables;

    public void execute(DelegateExecution execution) throws Exception {

        // Load all the variables into the Map
        variables = execution.getVariables();

        RuntimeService runtimeService = execution.getEngineServices()
                .getRuntimeService();
        runtimeService.startProcessInstanceByKey(processKey, variables);

    }
}

希望有所帮助。