jBPM, is the full name of the Java Business Process Management, is a lightweight J2EE-based workflow management system. jBPM is an open-source projects, follow the Apache License.  On October 18, 2004, jBPM released version 2.0. On the same day it joined the JBoss, and became part the JBoss enterprise middleware platform and named as the JBoss jBPM.

jBPM has two characteristics that made it one of the biggest star. One of the biggest features is its definition of business logic did not use some of the current norms, such as WfMC’s XPDL, BPML, ebXML, BPEL4WS, and so on, but its own definition of the JBoss jBPM Process definition language (jPdl). jPdl a business logic process as a UML state diagram, if you are not familiar with UML state diagram, that learning the language of the computer flow chart you should be familiar with the express ways and means more or less the same. jPdl detailed definition of the status of each part of the map, such as start, end, the conversion between the state and so on; their integration is another feature of Hibernate, said to be the exact binding, the use of Hibernate to manage the database, so jBPM Only focus on his control of business processes.

From the above we can see, jBPM is a business process management engine, a workflow engine.  In addition, at the same time it realized its jPDL and BPEL support. It integrates technology to deal with Hibernate database, to create a series of database tables, persistent workflow engine required for the state. Therefore, jBPM supports all Hibernate support of the database, to be able to Java Persistence object to the database, Hibernate to support the Java class object database to save!

You may like to use the Java class libraries, like the use of JBoss jBPM, but also through the allocation of JBoss jBPM can be deployed in other J2EE application server and any database.

In this article, we first of all to create our running JBoss jBPM development environment. Before you begin, please look ready software products:

  • JDK 1.5 or later, here the use of JDK 6u10b
  • Apache Tomcat 5.5.x or later, here using Tomcat 6.0.16
  • MySQL 5.1, can also choose to support other Hiberante database is not much difference here, the use of MySQL 5.1
  • Apache Ant 1.7.0
  • JBPM -3.2.3
  • Eclipse Europa (Eclipse V3.3) for JavaEE Developers or higher, where the use of Eclipse V3.4

Note: JBoss jBPM release of the package have already configured a set of environmental services, is based on the JBoss. Because we are used to compact the Tomcat flexible, and we do not want jBPM to rely on JBoss.

1. Download and install JDK, Tomcat, Ant, MySQL, and set the appropriate environment variables

This step is no longer referred to boil, please refer to a specific official documents.

Jdk: http://java.sun.com/

Ant: http://ant.apache.org/

Tomcat: http://tomcat.apache.org/

Eclipse: http://www.eclipse.org/

2. Download JBoss jBPM

JBoss jBPM official (http://www.jboss.org/jbossjbpm/) released the current version 3.2.3, simply download jPDL Suite, download after jbpm-jpdl-suite-3.2.3.zip, the package includes All of the content and resources, including plug-in eclipse, sample, process management and control applications.

Decompress jbpm-jpdl-suite-3.2.3.zip to D:\jbpm-jpdl-3.2.3, the main directory is structured as follows:

D:\jbpm-jpdl-3.2.3

| — db here are some definitions and sql data files, if the switch to other databases, you can use these resources to create, services or very thoughtful. jBPM is used by default memory database hsqldb.

|—deploy to the deployment of your application package and resources

|— designer  here is the Eclipse plug-in, so you can use the graphical interface to define your business processes

|— doc here jBPM is relevant components of the API documentation

|— examples  here are some examples of learning

|— lib  jBPM the class library

|— server  There is a JBoss server, and includes the JBoss jBPM engine, and thedeployment of the examples websale

|— src  this is the source code of JBoss jBPM

3. Configuration database

jBPM need to initialize the data storage and workflow definition to the database, which defines a set of data structures to store the data, which is characterized by the container itself.

In mysql, crate a database jbpm, (create database jbpm;), and create a user jbossjbpm (password: jbossjbpm)

Note: If you find it troublesome and can use the root account and password, but please do the following to set the appropriate changes

In D:\jbpm-jpdl-3.2.3 \ db find jbpm.jpdl.mysql.sql, the document must be changed a bit, to comply with the grammatical structure of MySQL. In each specific statement at the end of the addition of a semicolon ";" You can use UltrEdit, EditPlus, and other tools to do these things (to be replaced by attention to the attention of the match case, the table was included in the field CREATE characters), The first of these is the creation of a database table, it is necessary to remove the above statements create and alter the drop (of these tables do not exist yet).

4. JBPM is ready to pack

This is a jbpm-jpdl process management console, the Tomcat is like to have a separate application Administrator to manage the configuration and deployment of the same East. You can have it in the graphical interface to control the operation of your application.

Open the command-line console, switch to the D:\jbpm-jpdl-3.2.3\deploy directory, and the following command:

ant customize.console.for.tomcat ant customize.console.for.tomcat

Note: Make sure you install the ant properly configured, you can enter the command line: ant-version to detect whether or not the correct installation of the ant. After the implementation of the order to see the ant version of the information that is OK.

After the successful implementation of the ant customize.console.for.tomcat, there will be D:\jbpm-jpdl-3.2.3\deploy directory and the target to generate customized catalog, customized directory jbpm-console.war that is what we want war package.

We need to modify the file Jbpm-console.war/WEB-INF/classes/hibernate.cfg.xml to meet the attributes of our resources.

The results are as follows:

<hibernate-configuration>
  <session-factory>
 
    <!-- hibernate dialect -->
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
 
    <!-- JDBC connection properties (begin) -->
    <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">jbossjbpm</property>
    <property name="hibernate.connection.password">jbossjbpm</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) -->
    <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
...

 

This changed the default properties of the data, JDBC connection properties, also has its own definition of the name and account data:

<property name="hibernate.transaction.factory_class"> org.hibernate.transaction.JDBCTransactionFactory </property>

Instead of JTATransactionFactory and CMTTransactionFactory, would like to JTATransactionFactory or CMTTransactionFactory can also be configured.

Copy Jboss-j2ee.jar copy package to jbpm-console.war/WEB-INF/lib.

Here is to use the Java Transaction Architecture, so you can use the J2EE package jta.jar also replace jboss-j2ee.jar. more jta information please refer to: http://java.sun.com/javaee/technologies/jta/index.jsp

Copy Commons-collections.jar copy package to jbpm-console.war/WEB-INF/lib. This package is a package Apache Commons, everywhere looking to the.

Copy Jsf-api.jar and jsf-impl.jar package to jbpm-console.war/WEB-INF/lib, you can find the two kinds of packages in D:\jbpm-jpdl-3.2.3\server \server\jbpm\deploy\jboss-web.deployer\jsf-libs

Note: jbpm-console is a jsf application, not the two packages, you will be reported when 404 or 505 errors.

Copies of MySQL JDBC driver package to%CATALINA_HOME%/lib (Tomcat 6), or %CATALINA_HOME%/common/lib (Tomcat 5.5)

Copy the modified copy of the jbpm-console to %CATALINA_HOME%/webapps

JBPM this configuration is basically completed, but we can not visit him, and also need to configure security access control and the initial user data

5. Tomcat configuration security domain

Method One:

In %CATALINA_HOME%/conf/Catalina/localhost create a jbpm-console.xml document, which reads as follows:

<context>
<realm classname="org.apache.catalina.realm.JDBCRealm" drivername="com.mysql.jdbc.Driver" connectionurl="jdbc:mysql://localhost:3306/jbpm" connectionname="jbossjbpm" connectionpassword="jbossjbpm" usertable="JBPM_ID_USER u, JBPM_ID_MEMBERSHIP m, JBPM_ID_GROUP g" usernamecol="g.TYPE_ = &#39;security-role&#39; 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>

 

Method Two:

Modify %CATALINA_HOME%/conf/tomcat-users.xml file to set up the security domain. In order not to tomcat and existing users of the conflict, where the tomcat before landing the account username = "admin" was revised to username = "tadmin", the revised document is as follows:

&lt;?xml version='1.0' encoding='utf-8'?&gt;
 
<tomcat-users>
 
  <role rolename="user" />
 
  <role rolename="administrator" />
 
  <role rolename="manager" />
 
  <role rolename="sales" />
 
  <role rolename="hr" />
 
  <role rolename="admin" />
 
  <role rolename="participant" />
 
  <user roles="user,sales" password="user" username="user" />
 
  <user roles="user,hr" password="shipper" username="shipper" />
 
  <user roles="admin,hr,manager,user,sales" password="manager" username="manager" />
 
  <user roles="admin,manager" password="" username="tadmin" />
  <user roles="admin,user,hr" password="admin" username="admin" />
</tomcat-users>

6. Initialized data

Inserting the following data into the jbpm database:

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. Restart Tomcat

Restart services, view the console log, rule out the errors, database errors and incomplete support for the library could lead to errors.

In a browser, type: http://localhost:8080/jbpm to visit the deployment, you can be listed on the page and user experience into account landing.

Tags: , , ,