jBPM-4.2默认提供的与spring整合的文件存在重大问题,使用官方推荐的配置方式根本无法启动流程引擎,需要进行如下修改:
第1步:将下面的内容保存为jbpm.tx.spring42.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
<process-engine-context>
<command-service name="txRequiredCommandService">
<skip-interceptor />
<retry-interceptor />
<environment-interceptor />
<spring-transaction-interceptor />
</command-service>
<command-service name="newTxRequiredCommandService">
<retry-interceptor />
<environment-interceptor policy="requiresNew" />
<spring-transaction-interceptor />
</command-service>
</process-engine-context>
<transaction-context>
<transaction />
<hibernate-session />
</transaction-context>
</jbpm-configuration>
第2步:将jbpm.tx.spring42.cfg.xml放在classpath下。
第3步:修改jbpm.cfg.xml,使用jbpm.tx.spring42.cfg.xml替换默认的jbpm.tx.spring.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.tx.spring42.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<!-- Job executor is excluded for running the example test cases. -->
<!-- To enable timers and messages in production use, this should be included. -->
<!--
<import resource="jbpm.jobexecutor.cfg.xml" />
-->
<import resource="jbpm.mail.templates.examples.xml" />
</jbpm-configuration>
这样就使用修改后的配置文件实现jBPM-4.2与spring的整合了。