|
Posted on 2011-04-20 23:45 石子路口 阅读(1484) 评论(0) 编辑 收藏 所属分类: 工作流
STEP 1,初始化数据库
上一篇文章中有jbpm的数据库初始化,可参考http://www.blogjava.net/tantanxiaoshi/archive/2011/04/13/348254.html
STEP 2,准备发布包
在E:\Java\tools\jbpm-jpdl-3.2.2\deploy 文件夹下 运行ant customize.console.for.tomcat。执行命令后会在 E:\Java\tools\jbpm-jpdl-3.2.2\deploy\customized文件夹下生成一个jbpm-console.war 文件,用WinRaR解压开,并复制到已安装Tomcat的webapps目录下,jbpm还需三个依赖类库,分别是commons-collections.jar、ehcache-1.2.3.jar、jta.jar,当然还有个MySQL驱动mysql-connector-java-5.0.7-bin.jar,添加这些jar文件 到 \$CATALINA_HOME\webapps\jbpm-console\WEB-INF\lib目录下。
STEP 3,修改Hibernate数据库配置文件
修改\$CATALINA_HOME\webapps\jbpm-console\WEB-INF\classes下hibernate.cfg.xml文件。这是Hibernate的数据库配置文件,要做一些修改,原来内容如下:
<!-- hibernate dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<!-- JDBC connection properties (begin) ===
<property name="hibernate.connection.driver_class">
org.hsqldb.jdbcDriver</property>
<property name="hibernate.connection.url">jdbc:hsqldb:mem:jbpm</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
==== JDBC connection properties (end) -->
<property name="hibernate.cache.provider_class">
org.hibernate.cache.HashtableCacheProvider</property>
<!-- DataSource properties (begin) -->
<property name="hibernate.connection.datasource">java:/JbpmDS</property>
<!-- DataSource properties (end) -->
修改后如下:
<!-- hibernate dialect -->
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLInnoDBDialect</property>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">
jdbc:mysql://localhost:3306/jbpm</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.HashtableCacheProvider</property>
STEP 4,设置Tomcat安全域
因为使用了tomcat6,所以采用以下方法:直接修改 /$CATALINA_HOME/conf/tomcat-users.xml文件来设置安全域。为了不和tomcat已有的用户冲突,这里把 tomcat以前的登陆帐号username="admin" 修改为username="tadmin",修改后的文件如下:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="user"/>
<role rolename="administrator"/>
<role rolename="manager"/>
<role rolename="sales"/>
<role rolename="hr"/>
<role rolename="admin"/>
<role rolename="participant"/>
<user username="user" password="user" roles="user,sales"/>
<user username="shipper" password="shipper" roles="user,hr"/>
<user username="manager" password="manager" roles="admin,hr,manager,user,sales"/>
<user username="tadmin" password="" roles="admin,manager"/>
<user username="admin" password="admin" roles="admin,user,hr"/>
</tomcat-users>
STEP 5,初始化基础的用户数据
在MySQL数据库中执行以下SQL语句,进行初始化用户信息,如下:
INSERT INTO JBPM_ID_GROUP VALUES(1,'G','sales','organisation',NULL);
INSERT INTO JBPM_ID_GROUP VALUES(2,'G','admin','security-role',NULL);
INSERT INTO JBPM_ID_GROUP VALUES(3,'G','user','security-role',NULL);
INSERT INTO JBPM_ID_GROUP VALUES(4,'G','hr','organisation',NULL);
INSERT INTO JBPM_ID_GROUP VALUES(5,'G','manager','security-role',NULL);
INSERT INTO JBPM_ID_USER VALUES(1,'U','user','user@sample.domain','user');
INSERT INTO JBPM_ID_USER VALUES(2,'U','manager','manager@sample.domain','manager');
INSERT INTO JBPM_ID_USER VALUES(3,'U','admin','admin@sample.domain','admin');
INSERT INTO JBPM_ID_USER VALUES(4,'U','shipper','shipper@sample.domain','shipper');
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(1,'M',NULL,NULL,2,4);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(2,'M',NULL,NULL,3,4);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(3,'M',NULL,NULL,4,4);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(4,'M',NULL,NULL,4,3);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(5,'M',NULL,NULL,1,3);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(6,'M',NULL,NULL,2,3);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(7,'M',NULL,NULL,3,3);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(8,'M',NULL,NULL,3,2);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(9,'M',NULL,NULL,2,2);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(10,'M',NULL,NULL,2,5);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(11,'M',NULL,'boss',2,1);
INSERT INTO JBPM_ID_MEMBERSHIP VALUES(12,'M',NULL,NULL,1,1);
STEP 6,启动Tomcat服务
启动时查看Tomcat的日志,检查是否正常启动,未添加所有支持库或数据库配置出错,都会引起启动失败。
注意:到此为止启动Tomcat,JBPM服务就能正常运行了,已经可以在上面发布流程,接着第五步中部署一个jbpm自带的流程例子。
STEP 7,发布例子流程
打开网页:http://localhost:8181/jbpm-console 得到如下页面就说明已经部署成功:
参考原文: http://www.uml.org.cn/workclass/200809085.asp
|