JBPM WEB CONSOLE安装实录

http://www.blogjava.net/paulwong/archive/2009/03/13/259551.html

JBPM WEB CONSOLE是一个B/S端的,能管理JBPM的流程和实例。

1、下载jbpm-jpdl-3.2.3。

2、安装TOMCAT 6.0,注意,这个版本的JBPM由于使用了JSF 1.2,而5.5以下的不支持。

3、安装ANT。

4、安装MYSQL 5.0,建立JBPM表,可以ANT,或在数据库中执行SCRIPT建立。

5、制作JBPM CONSOLE的WAR包。
转到DOS运行模式,去到deploy目录,运行ant  customize.console.for.tomcat,生成两个目录:customized和target,将缺少的JAR包加入到WAR包中的WEB-INF/lib中,最后完整的JAR包

activation.jar
antlr-2.7.6.jar
asm.jar
bsh.jar
cglib.jar
commons-beanutils-1.8.0.jar
commons-collections.jar
commons-digester-1.8.jar
commons-fileupload.jar
commons-io.jar
commons-logging.jar
dom4j.jar
gravel.jar
hibernate3.jar
jboss-backport-concurrent.jar
jboss-j2ee.jar
jboss-retro-1.1.0-rt.jar
jbpm4jsf.jar
jbpm-identity.jar
jbpm-jpdl.jar
jsf-api.jar
jsf-facelets.jar
jsf-impl.jar
jstl.jar
mysql-connector-java-5.0.4-bin.jar
servlet-api.jar
standard-1.0.6.jar

修改WEB.XML里面的其中SECURITY元素为:

    <security-role>
        
<role-name>admin</role-name>
    
</security-role>
    
<security-role>
        
<role-name>user</role-name>
    
</security-role>

    
<!--
       Security constraints - uncomment and optionally customize the role name to require
       a login before access is allowed to the application.

       Also, be sure to edit jboss-web.xml to configure the security domain if you are
       deploying inside JBossAS.
    
-->
    
<security-constraint>
        
<web-resource-collection>
            
<web-resource-name>Secure Area</web-resource-name>
            
<url-pattern>/sa/*</url-pattern>
            
<http-method>GET</http-method>
            
<http-method>POST</http-method>
        
</web-resource-collection>
        
<auth-constraint>
            
<role-name>user</role-name>
            
<role-name>admin</role-name>
        
</auth-constraint>
    
</security-constraint>

修改hibernate.cfg.xml
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>


6、配置TOMCAT。
把MYSQL的驱动COPY到lib下;增加数据源

  <Resource
    
type="javax.sql.DataSource"
    name
="jdbc/JbpmDataSource"
    url
="jdbc:mysql://localhost/jbpm"
    password
="888"
    validationQuery
="SELECT * FROM jbpm_processdefinition j;"
    driverClassName
="com.mysql.jdbc.Driver"
    maxWait
="5000"
    username
="root"
    maxIdle
="2"
    maxActive
="4"/>

增加LOGIN CONSOLE的用户,有两种方式
1)修改tomcat-users.xml为
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  
<role rolename="user"/>
  
<role rolename="role1"/>
  
<role rolename="admin"/>
  
<role rolename="tomcat"/>
  
<role rolename="manager"/>
  
<user username="role1" password="tomcat" roles="role1"/>
  
<user username="admin" password="888" roles="manager,admin,user"/>
  
<user username="both" password="tomcat" roles="tomcat,role1"/>
  
<user username="tomcat" password="tomcat" roles="tomcat"/>
</tomcat-users>

2)配置用户从数据库中读取,修改jbpm-console.xml:
<Context>
<Realm  className="org.apache.catalina.realm.JDBCRealm 
          driverName="
com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/jbpm"
          connectionName
="root" 
          connectionPassword
="自己的密码"
          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_" />
</Context>

向数据库中插入以下数据:
 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);


7、启动TOMCAT,部署刚才生成的WAR包,输入http://localhost:8080/jbpm-console访问,用户名:admin,密码:888

原文地址:https://www.cnblogs.com/bluejoe/p/5115974.html