Tomcat5.5.14+MSSQL2000部署JBPM3.2.1 DEMO

学习JBPM已经2周了,看了Java Eye上各位老大的帖子,收获良多。今天尝试将JBPM3.2.1的Web-console发布至Tomcat+MSSQL,记录学习过程:)

1          部署环境:
JDK1.5.9
Tomcat5.5.14
JBPM3.2.1
MS SQL Server2000
2          步骤:
2.1         创建数据库表
1.         在SQL2000中创建JBPM数据库
2.         创建数据库表,脚本见db/jbpm.jpdl.mssql.sql ,在查询分析器中执行后生成JBPM所需的所有表。
2.2         创建jBPM示例应用
1.         执行deploy下的build.xml文件 ant customize.console.for.tomcat,在deploy文件夹下生成customized文件夹,其下jbpm-console.war即为我们所需应用,要使其在Tomcat下正常运行,先将其解压缩,还需要进行如下一系列的改动。ant
2.         修改WEB-INF/classes/hibernate.cfg.xml如下:
 

<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>   

              <property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>   

              <property name="hibernate.connection.url">jdbc:jtds:sqlserver://localhost:1433/jbpm3_2</property>   

              <property name="hibernate.connection.username">sa</property>   

              <property name="hibernate.connection.password">sa</property>

              <property name="hibernate.show_sql">true</property>

<o:p> </o:p>

    <!---->

   

    <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>

    <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
 
3.         拷贝如下jar包至WEB-INF/lib
jboss-j2ee.jar;commons-collection.jars;el-api.jar;el-ri.jar; jtds-1.2.jar(MSSQL 的JDBC Driver)
4.         创建用户数据
SET IDENTITY_INSERT JBPM_ID_GROUP ON;
INSERT INTO JBPM_ID_GROUP (ID_,CLASS_,NAME_,TYPE_,PARENT_) VALUES(1,'G','sales','organisation',NULL);
INSERT INTO JBPM_ID_GROUP (ID_,CLASS_,NAME_,TYPE_,PARENT_) VALUES(2,'G','admin','security-role',NULL);
INSERT INTO JBPM_ID_GROUP (ID_,CLASS_,NAME_,TYPE_,PARENT_) VALUES(3,'G','user','security-role',NULL);
INSERT INTO JBPM_ID_GROUP (ID_,CLASS_,NAME_,TYPE_,PARENT_) VALUES(4,'G','hr','organisation',NULL);
INSERT INTO JBPM_ID_GROUP (ID_,CLASS_,NAME_,TYPE_,PARENT_) VALUES(5,'G','manager','security-role',NULL);
SET IDENTITY_INSERT JBPM_ID_GROUP OFF;
 
SET IDENTITY_INSERT JBPM_ID_USER ON;
INSERT INTO JBPM_ID_USER (ID_,CLASS_,NAME_,EMAIL_,PASSWORD_) VALUES(1,'U','user','[email protected]','user');
INSERT INTO JBPM_ID_USER (ID_,CLASS_,NAME_,EMAIL_,PASSWORD_) VALUES(2,'U','manager','[email protected]','manager');
INSERT INTO JBPM_ID_USER (ID_,CLASS_,NAME_,EMAIL_,PASSWORD_) VALUES(3,'U','admin','[email protected]','admin');
INSERT INTO JBPM_ID_USER (ID_,CLASS_,NAME_,EMAIL_,PASSWORD_) VALUES(4,'U','shipper','[email protected]','shipper');
SET IDENTITY_INSERT JBPM_ID_USER OFF;
 
SET IDENTITY_INSERT JBPM_ID_MEMBERSHIP ON;
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(1,'M',NULL,NULL,2,4);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(2,'M',NULL,NULL,3,4);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(3,'M',NULL,NULL,4,4);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(4,'M',NULL,NULL,4,3);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(5,'M',NULL,NULL,1,3);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(6,'M',NULL,NULL,2,3);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(7,'M',NULL,NULL,3,3);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(8,'M',NULL,NULL,3,2);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(9,'M',NULL,NULL,2,2);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(10,'M',NULL,NULL,2,5);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(11,'M',NULL,'boss',2,1);
INSERT INTO JBPM_ID_MEMBERSHIP (ID_,CLASS_,NAME_,ROLE_,USER_,GROUP_) VALUES(12,'M',NULL,NULL,1,1);
SET IDENTITY_INSERT JBPM_ID_MEMBERSHIP OFF;
 
5.         设置Tomcat的JDBC Realm
In 3.1 jBPM used it's own mechanism, in 3.2 the authentication is left to the container. ”这句话重点注意, 3.2 authentication 交给容器来做!具体 Realm 是什么还没搞懂,只知道是一种容器管理安全性的方式。先照着做吧。
在Tomcat的conf/Catalina/locahost目录下新建jbpm-console.xml 内容如下:
<context></context>
 <context></context><o:p></o:p>

       <realm classname="org.apache.catalina.realm.JDBCRealm"></realm>

              driverName="net.sourceforge.jtds.jdbc.Driver"

              connectionURL="jdbc:jtds:sqlserver://localhost:1433/jbpm3_2"

              connectionName="sa" connectionPassword="sa"

              userTable="JBPM_ID_USER u, JBPM_ID_MEMBERSHIP m, JBPM_ID_GROUP g"

              userNameCol="g.TYPE_ = 'security-role' AND m.GROUP_ = g.ID_ AND m.USER_ = u.ID_ AND u.NAME_"

              userCredCol="DISTINCT u.PASSWORD_"

              userRoleTable="JBPM_ID_USER u, JBPM_ID_MEMBERSHIP m, JBPM_ID_GROUP g"

              roleNameCol="g.NAME_" /><o:p></o:p>

 
6.         拷贝修改过的jbpm-console至webapp目录下。输入 http://localhost:8080/jbpm-console,登录即可。
7.         补:我们未将任何流程发布到应用中,所以用户登录后看不到任何流程定义。发布流程可以直接使用jbpm designer.将做好的流程,如websale直接部署到jbpm-console中就可以了。
 
 
3          参考
1.         http://wiki.jboss.org/wiki/Wiki.jsp?page=JbpmOnTomcat

你可能感兴趣的:(tomcat,Hibernate,jdbc,jboss,jbpm)