jbpm-3.3.1.GA安装详解
1.需要安装的软件:
Jdk 5
JBoss-5.0.0.GA
JSF1.1.15.jar
Mysql 5.1
JBPM-3.3.1.GA 在官网下载 http://www.jboss.org/jbossjbpm/jbpm_downloads/ 。
2.安装软件:
1). 首先安装jdk,安装好后一定要配置环境变量JAVA_HOME到你的JDK安装目录,因为jboss启动时会去找这个JAVA_HOME,否则启动会失败!
2). JBoss-5.0.0.GA下载后直接解压到你的工作目录下即可,下载地址:http://www.jboss.org/jbossas/downloads/
3). JSF1.1.15.jar自己在网上搜索下载
4). 运行安装 jbpm-installer-3.3.1.GA.jar,安装时只需指定你的JBoss安装目录即可,不需要其他配置。
3. 配置JBPM-3.3.1.GA :
1).启动mysql5,创建一个数据库jbpm,打开mysql5的控制台。使用命令(create database jbpm;)
向mysql插入以下数据:
insert into JBPM_ID_USER (ID_, CLASS_, NAME_, EMAIL_, PASSWORD_) values (‘1‘, ‘U‘, ‘user‘, ‘sample.user@sample.domain‘, ‘user‘);
insert into JBPM_ID_USER (ID_,CLASS_, NAME_, EMAIL_, PASSWORD_) values (‘2‘, ‘U‘, ‘manager‘, ‘sample.manager@sample.domain‘, ‘manager‘);
insert into JBPM_ID_USER (ID_,CLASS_, NAME_, EMAIL_, PASSWORD_) values (‘3‘, ‘U‘, ‘shipper‘, ‘sample.shipper@sample.domain‘, ‘shipper‘);
insert into JBPM_ID_USER (ID_,CLASS_, NAME_, EMAIL_, PASSWORD_) values (‘4‘, ‘U‘, ‘admin‘, ‘sample.admin@sample.domain‘, ‘admin‘);
insert into JBPM_ID_GROUP VALUES(1,‘G‘,‘admin‘,‘security-role‘,NULL);
insert into JBPM_ID_GROUP VALUES(2,‘G‘,‘manager‘,‘security-role‘,NULL);
insert into JBPM_ID_GROUP VALUES(3,‘G‘,‘user‘,‘organisation‘,NULL);
insert into JBPM_ID_MEMBERSHIP VALUES(1,‘M‘,NULL,‘user‘,1,3);
insert into JBPM_ID_MEMBERSHIP VALUES(2,‘M‘,NULL,‘admin‘,2,1);
insert into JBPM_ID_MEMBERSHIP VALUES(3,‘M‘,NULL,‘manager‘,2,2);
insert into JBPM_ID_MEMBERSHIP VALUES(4,‘M‘,NULL,‘user‘,2,3);
insert into JBPM_ID_MEMBERSHIP VALUES(5,‘M‘,NULL,‘user‘,3,3);
insert into JBPM_ID_MEMBERSHIP VALUES(6,‘M‘,NULL,‘admin‘,4,1);
insert into JBPM_ID_MEMBERSHIP VALUES(7,‘M‘,NULL,‘user‘,4,3);
2).导入jbpm所需要的表结构,如C:\jbpm-3.3.1.GA\database\jbpm.jpdl.mysql.sql
3).配置jboss-5.0.0.GA 中的JBPM3.3项目,修改jbpm-mysql-ds.xml文件,路径如C:\jboss-5.0.0.GA\server\default\deploy\jbpm。修改成你的mysql用户名和密码:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>JbpmDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/jbpm</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>admin</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
添加jsf-facelets-1.1.15.jar和mysql驱动jar,将这两个包拷贝过去,如:C:\jboss-5.0.0.GA\server\default\deploy\jbpm\jsf-console.war\WEB-INF\lib下,注意要删除jsf-facelets-1.1.14.jar,原因可能是兼容问题。
4).配置安全域:如,C:\jboss-5.0.0.GA\server\default\deploy\jbpm\jsf-console.war\WEB-INF\web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure Area</web-resource-name>
<url-pattern>/app/*</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>
修改login-config.xml ,如C:\jboss-5.0.0.GA\server\default\conf\login-config.xml在最后一行</policy>前增加一下内容:
<application-policy name = “jbpm-console”>
<authentication>
<login-module code=”org.jboss.security.auth.spi.DatabaseServerLoginModule” flag=”required”>
<module-option name=”dsJndiName”>java:/JbpmDS</module-option>
<module-option name=”principalsQuery”>
SELECT PASSWORD_ FROM JBPM_ID_USER WHERE NAME_=?
</module-option>
<module-option name=”rolesQuery”>
SELECT g.NAME_ ,’Roles’
FROM JBPM_ID_USER u,
JBPM_ID_MEMBERSHIP m,
JBPM_ID_GROUP g
WHERE g.TYPE_=’security-role’
AND m.GROUP_ = g.ID_
AND m.USER_ = u.ID_
AND u.NAME_=?
</module-option>
</login-module>
</authentication>
</application-policy>
配置结束,我们启动jboss,访问http://localhost:8080/jbpm-console/ 用admin/admin登录。
注意:如果部署出现错误,可以试着更改两个文件,可能是jbpm的bug,目录:C:\jboss-5.0.0.GA\server\default\deploy\jbpm\jsf-console.war\app中
修改t_processinstances.xhtml文件第68行开始:
<td style=”white-space:nowrap;”>
<h:selectBooleanCheckbox id=”running_i” value=”#{filter_running== ‘true’}”/>
<gs:label forId=”running_i” styleClass=”statusRunning”>R</gs:label>
<h:selectBooleanCheckbox id=”suspended_i” value=”#{filter_suspended == ‘true’}”/>
<gs:label forId=”suspended_i” styleClass=”statusSuspended”>S</gs:label>
<h:selectBooleanCheckbox id=”ended_i” value=”#{filter_ended == ‘true’}”/>
<gs:label forId=”ended_i” styleClass=”statusEnded”>E</gs:label>
</td>
修改t_tasks.xhtml文件第74行开始:
<td style=”width:120px;white-space:nowrap”>
<h:selectBooleanCheckbox id=”task_notstarted_i” value=”#{task_filter_notstarted == ‘true’}”/>
<gs:label forId=”task_notstarted_i” styleClass=”statusNotstarted”>N</gs:label>
<h:selectBooleanCheckbox id=”task_running_i” value=”#{task_filter_running == ‘true’}”/>
<gs:label forId=”task_running_i” styleClass=”statusRunning”>R</gs:label>
<h:selectBooleanCheckbox id=”task_suspended_i” value=”#{task_filter_suspended == ‘true’}”/>
<gs:label forId=”task_suspended_i” styleClass=”statusSuspended”>S</gs:label>
<h:selectBooleanCheckbox id=”task_ended_i” value=”#{task_filter_ended == ‘true’}”/>
<gs:label forId=”task_ended_i” styleClass=”statusEnded”>E</gs:label>
</td>