JBPM4.4整合SSH2项目

一:导入相应的jar包:
*注意事项:
(1).与项目中的jar包不能出现冲突
(2).版本应一致
jbpm-bpmn.jar
jbpm-console-form-plugin.jar
jbpm-console-graphView-plugin.jar
jbpm-console-integration.jar
jbpm-console-reports.jar
jbpm-db.jar
jbpm-examples-tests.jar
jbpm-jboss.jar
jbpm-test-db-tests.jar
jbpm-tomcat6.jar
jbpm.jar
livetribe-jsr223.jar
mail.jar
项目已经整合了SSH2,那么只需要在添加:
jbpm.jar,
juel-api.jar,

juel-engine.jar,
jues-impl.jar,
mail.jar,

livetribe-jsr223.jar即可
其中下面三个放到tomcat的lib包目录下,因为这三个包会和tomcat的el-api.jar发生冲突,应先注释掉el-api.jar
 Juel-api.jar
 Juel-engine.jar
 Juel-impl.jar
二:修改配置文件:
(1).添加jbpm.cfg.xml文件,文件内容如下:
 <import resource="jbpm.default.cfg.xml" />
 
 <import resource="jbpm.businesscalendar.cfg.xml" />
 
 <import resource="jbpm.tx.hibernate.cfg.xml" />
 
 <import resource="jbpm.jpdl.cfg.xml" />
 
 <import resource="jbpm.bpmn.cfg.xml" />
 
 <import resource="jbpm.identity.cfg.xml" />
(2).因为项目中hibernate.cfg.xml文件与jbpm.hibernate.cfg.xml文件冲突,所以修改hibernate.cfg.xml文件:添加Jbpm所需要的配置文件:
<!--导入JBPM工作流的映射文件,修改添加工作流-->
 <mapping resource="jbpm.repository.hbm.xml" />
 <mapping resource="jbpm.execution.hbm.xml" />
 <mapping resource="jbpm.history.hbm.xml" />
 <mapping resource="jbpm.task.hbm.xml" />
 <mapping resource="jbpm.identity.hbm.xml" />
(3).生成JBPM的18张表:
@Test
public void createJbpm(){
ApplicationContext ac = new ClassPathXmlApplicationContext("beans.xml");
SessionFactory sf = (SessionFactory) ac.getBean("sessionFactory");
System.out.println("SessionFactory:"+sf);
}
三:整合Spring
(1).调用流程引擎不再使用:
processEngine processEngine = Configuration.getProcessEngine();
(2).修改jbpm.cfg.xml文件,与Spring进行整合的文件:
<?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.hibernate.cfg.xml" /> -->
  <!-- 整合Spring -->
  <import resource="jbpm.tx.spring.cfg.xml" />
  <import resource="jbpm.jpdl.cfg.xml" />
  <import resource="jbpm.bpmn.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" />
  -->
</jbpm-configuration>
(3).在Spring的配置文件beans.xml中配置ProcessEngine,添加:
<!-- JBPM与spirng进行整合,创建流程引擎对象 -->
 <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
    <property name="jbpmCfg" value="jbpm.cfg.xml"></property>
 </bean>
 <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
(4).测试流程引擎对象:
@Test
public void testProcessEngine(){
ApplicationContext ac = new ClassPathXmlApplicationContext("beans.xml");
ProcessEngine processEngine = (ProcessEngine)ac.getBean("processEngine");
	System.out.println("PorcessEngine:"+processEngine);
}
出现:org.jbpm.pvm.internal.processengine.SpringProcessEngine@ee3dee,表示成功
(5).使用流程引擎对象:
在Service层使用:
@Resource
private ProcessEngine processEngine;

四:启动Tomcat服务器的配置:
(1).jbpm使用了el表达式的3个jar包,分别是Juel-api.jar,Juel-engine.jar,Juel-
impl.jar。这与tomcat的el-api.jar发生冲突
解决:可将tomcat的lib下删除el-api.jar,添加Juel-api.jar,Juel-engine.jar,
Juel-impl.jar
(2).修改hibernate.cfg.xml文件,将:
<property name="hibernate.dialect">
 org.hibernate.dialect.MySQL5Dialect
</property>
修改成为:
<property name="hibernate.dialect">
org.hibernate.dialect.MySQL5InnoDBDialect
</property>

你可能感兴趣的:(JBPM4.4)