Jbmp installation and configuration process

Source: Internet
Author: User

Jbpm, short for Java business process management, is a lightweight workflow management system based on J2EE. Jbpm is a public source code project that complies with Apache license.

Jbpm configuration is still relatively easy, but the configuration process is a little troublesome, but as long as you have a certain degree of foundation, it is very easy to understand. At the beginning of configuration, I always "error" that the JNDI is not bound, instead of "information" that the JNDI is not bound. The difference between the two is that "error" indicates that the configuration is incorrect, the "information" indicates that I know it can be implemented through the JNDI binding method, but I didn't use it.

The following describes the configuration process and the JDBC-based direct connection. You do not need to consider configuring the data source. If the exception information about the data source appears during this process, you have considered the configuration of the data source When configuring the direct JDBC connection.

System Environment

Operating System: Windows XP SP2

Jbpm version: jbpm-jpdl-suite-3.2.3

Web server: Tomcat 6.0

JDK version: Sun jdk1.6

MySQL: 5.0.

Browser: Internet Explorer 6.0

Ant version: ant 1.7.1

Install configurations

There are two main parts:

Install and configure JDK, ant, tomcat, and MYSQL: omitted.

Another part is the preparation of the jbpm-jpdl-suite-3.2.3, detailed description.

1. Download jbpm-jpdl-suite-3.2.3.zip

JBoss jbpm official (http://www.jboss.org/jbossjbpm/) is currently released version 3.2.3, only need to download jpdl suite, download to jbpm-jpdl-suite-3.2.3.zip, unzip to get the following files and directories under the jbpm-jpdl-3.2.3 directory:


└-Jbpm-jpdl-3.2.3
│ Jboss.eula.txt
│ Jbpm-identity.jar.
│ Jbpm-jpdl.jar.
│ License.txt
│ Readme.html
│ Release.notes.html
│ X.txt

├ ── Config

Analytic DB

Pai── deploy

├ ── Designer

─ ── Doc

├ ── Examples

├ ── Lib

├ ── Server

└ ── SRC

 

2. MySQL Database Configuration

Start the MySQL database server. I use root to log on and create a database jbpm.

Then, under the jbpm-jpdl-3.2.3 \ dB directory, you can see the SQL script file of the database, find jbpm. jpdl. mySQL. SQL file, add a semicolon at the end of each line, for example, the original is:

Alter table jbpm_action drop foreign key fk_action_refact
Alter table jbpm_action drop foreign key fk_crtetimeract_ta
Alter table jbpm_action drop foreign key fk_action_procdef
Alter table jbpm_action drop foreign key fk_action_event
Alter table jbpm_action drop foreign key fk_action_actndel
Alter table jbpm_action drop foreign key fk_action_expthdl

 

After modification, it should be:

Alter table jbpm_action drop foreign key fk_action_refact;
Alter table jbpm_action drop foreign key fk_crtetimeract_ta;
Alter table jbpm_action drop foreign key fk_action_procdef;
Alter table jbpm_action drop foreign key fk_action_event;
Alter table jbpm_action drop foreign key fk_action_actndel;
Alter table jbpm_action drop foreign key fk_action_expthdl;

 

Then, run the SQL script file on the MySQL database server to create all tables in the database jbpm. Run the following command:

Mysql> source D: \ jbpm \ jbpm-jpdl-suite-3.2.3 \ jbpm-jpdl-3.2.3 \ dB \ jbpm. jpdl. MySQL. SQL;

 

From jbpm. jpdl. mySQL. the content of the SQL file shows that if you execute this script file for the first time, it first assumes that these tables exist in the Database jbpm and performs the delete operation before creating the table.

Next, you can initialize the database and insert data into it:

Insert into jbpm_id_group values (1, 'G', 'sales', 'organization', 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', 'organization', 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 );

 

Save as the insert. SQL file and run the following command on the MySQL database server:

Mysql> source D: \ jbpm \ jbpm-jpdl-suite-3.2.3 \ jbpm-jpdl-3.2.3 \ dB \ insert. SQL;

 

3. jbpm console Configuration

Jbpm manages processes through the Web Console. Therefore, it is a bit difficult to configure, but it is easy to understand.

Make sure that your ant is correctly configured, then start a cmd window, cut to the jbpm-jpdl-3.2.3 \ deploy (my D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy) directory, run the following command:

Ant customize. Console. For. Tomcat

 

The execution result is as follows:

C: \ Documents ents and Settings \ shiyanjun> D:

D: \> Cd D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy

D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy> ant customize. Console. For. Tomcat
Buildfile: Build. xml

Customize. Console. For. Tomcat:
[Mkdir] created dir: D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy \ target \ war
[Mkdir] created dir: D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy \ customized
[UNZIP] expanding: D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy \ jbpm-console.
War into D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy \ target \ war
[Copy] copying 9 files to D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy \ targe
T \ war \ WEB-INF \ Lib
[Zip] building ZIP: D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy \ customized
Jbpm-console.war

Build successful
Total time: 4 seconds
D: \ eclipse \ workbench \ jbpm-jpdl-3.2.3 \ deploy>

 

In this case, two directories, customized and target, are generated under the D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy directory.

Copy the jbpm-console.war file under the customized directory to webapps under the tomcat installation directory, start the Tomcat web server, and then modify the contents under the jbpm-Console Directory.

Modify the Directory D: \ eclipse \ workspace \ jbpm-jpdl-3.2.3 \ deploy \ target \ war \ WEB-INF \ Classes hibernate. cfg. XML file, you only need to modify the content of the property element before the mapping element. Initially, only the following three items are configured by default:

<Property name = "hibernate. dialect"> org. hibernate. dialect. hsqldialect </property>
<Property name = "hibernate. cache. provider_class"> org. hibernate. cache. hashtablecacheprovider </property>
<Property name = "hibernate. Connection. datasource"> JAVA: COMP/ENV/jdbc/jbpmdatasource </property>

 

After modification, you need to add it. Because it is a direct JDBC connection, the modification is as follows:

<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"> 111111 </property>
<Property name = "hibernate. cache. provider_class"> org. hibernate. cache. hashtablecacheprovider </property>
<Property name = "hibernate. transaction. factory_class"> org. hibernate. transaction. jdbctransactionfactory </property>

 

You need to comment out or delete the configuration related to the data source. Otherwise, an exception that the JNDI is not bound will be reported during the subsequent test to start Tomcat.

Next, introduce the relevant jar package file (jbpm-console is a JSF application ):

(1) Add the jboss-j2ee.jar, commons-collections.jar, jsf-api.jar, and jsf-impl.jar to the d: \ Tomcat 6.0 \ webapps \ jbpm-console \ WEB-INF \ lib directory.

Obtain the above four files:

The jboss-j2ee.jar can be obtained from the jbpm-jpdl-suite-3.2.3 \ jbpm-jpdl-3.2.3 \ lib directory;

Commons-collections.jar can be obtained from the jbpm-jpdl-3.2.3 \ Server \ jbpm \ lib directory;

The jsf-api.jar and jsf-impl.jar can be obtained from the jbpm-jpdl-3.2.3 \ Server \ jbpm \ deploy \ jboss-web.deployer \ JSF-libs directory.

(2) Add the MySQL JDBC driver jar package to the Tomcat shared directory: for example, I copy the mysql-connector-java-5.0.3-bin.jar file to the D: \ Tomcat 6.0 \ lib directory.

4. tomcat security domain configuration

Create a jbpm-console.xml file in % catalina_home %/CONF/Catalina/localhost with the following content:

<Context>
<Realm classname = "org. Apache. Catalina. realm. jdbcrealm"
Drivername = "com. MySQL. JDBC. Driver"
Connectionurl = "JDBC: mysql: // localhost: 3306/jbpm"
Connectionname = "root"
Connectionpassword = "111111"
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>

 

The MySQL database is used here. The connection name is root and the password is 111111.

Test jbpm

Start Tomcat. If no exception occurs, the configuration is successful. Note that the direct JDBC connection method is used and the hibernate data source is not configured for it. Therefore, exceptions related to the data source cannot occur.

Open http: // localhost: 8080/jbpm-console and you can see:

Log on to the jbpm console according to the example user account information shown in the figure. After logging on to the admin account ,:

If you log on for the first time and there is no items under processes, you can click deploy connection on the left side and select a workflow definition file (for example, select D: \ jbpm \ jbpm-jpdl-suite-3.2.3 \ jbpm-jpdl-3.2.3 \ examples \ websale \ target \ websale. jpdl), and then deploy the new process ,:

After deploy is executed, if the operation succeeds, the infomation page is displayed, showing all processes. You can view a workflow by using the process ID, including the intuitive process image for review.

Remember that some initialization data is inserted into the table in the database during the execution of the SQL script. You can view the initialization data on the jbpm console ,:

This completes the installation and configuration process.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.