Wednesday, April 5, 2017

How to Set-Up jBPM 6.5.0.Final (on WildFly 10.1.0.Final) Development Environment in Eclipse Neon

In this tutorial we are going to see how to set up jBPM 6.5.0.Final development environment locally. jBPM team did a excellent job by providing a complete jBPM 6.5.0.Final environment for you to just download and extract the jBPM 6.5.0.Final-installer-full.zip bundle and run the ant script, ant will take care of all the installation task for you...sounds interesting, please checkout jBPM document for further details. I highly recommend you to use the automated (ant script) jbpm-installer bundle provided by jBPM team.
For others those who prefer the manual installation, then proceed with the rest of the document.
Please download the following software in your local machine.....

kie-wb is a web based workbench or console, dashboard is for building business dashboards and reports and kie-server is the runtime execution server. All of these three components are web applications (war), it can be deploy into any java enabled server like IBM WebSphere, Oracle WebLogic, WildFly, Red Hat JBoss EAP and Apache Tomcat etc.

jBPM-6.5.0.Final on WildFly-10.1.0.Final integrated with Eclipse Neon development Environment

You have two options for developer process development environment, you can use kie workbench(kie-wb) or IDE like eclipse or JBoss developer studio for process development, also you can combine these two options (above diagram) for your convenience.
jBPM uses the JPA 2 to allow users to config whatever the datasource you want to use to persist runtime data. Out of the box jBPM uses h2 java SQL database for persisting runtime data. In this demo we use MySQL database for jBPM.
In my environment RHEL 7 is my operating system, you can use CentOS 7 alternatively if you don't have RHEL 7 installed.

1. Install JDK 8 and set CLASSPATH environment variable

1.1 If you don't have java installed in your system, In RHEL7/CentOS7, open a terminal and please type the following and enter,
                    yum install java-1.8.0-openjdk-devel
1.2 Setting java class path in RHEL 7 / CentOS 7.
In the terminal window, type the below and enter, make sure you enter the right java installed location, it will installed in the /usr/lib/jvm folder.

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el7_2.x86_64

export PATH=$PATH:$JAVA_HOME/bin

2. Install maven and and set CLASSPATH

2.1 To install maven, type the following command in terminal and enter

[root@localhost ~]# wget http://mirrors.gigenet.com/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip

2.2 Unzip into your development home folder(eg, /opt)

root@localhost ~]# unzip apache-maven-3.3.9-bin.zip -C /opt/

2.3 Setting maven in CLASSPATH, please type the following command in your terminal window and enter...

[psingaram@localhost apache-ant-1.9.7]$ export M2_HOME=/opt/apache-maven-3.3.9

[psingaram@localhost apache-ant-1.9.7]$ export M2=$M2_HOME/bin

[root@localhost opt]# PATH=$M2:$PATH


3. Install Eclipse Neon and install JBoss Integration Tools/plug-ins

3.1 To download eclipse neon, please type the following command and enter, this will download the eclipse neon into your local machine...
[root@localhost utils]# wget
http://ftp.jaist.ac.jp/pub/eclipse/technology/epp/downloads/release/neon/3/eclipse-jee-neon-3-linux-gtk-x86_64.tar.gz
3.2 Update eclipse.ini for java home, add the following line into your eclipse.ini file
-vm /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el7_2.x86_64/bin/java
3.3 Update eclipse neon with required development tools and plus-ins...
3.3.1 Install JBoss Tools 4.4.2.Final plugins
                    http://download.jboss.org/jbosstools/neon/stable/updates/
3.3.2 JBoss Tools Integration Stack 4.4.1.Final
         http://download.jboss.org/jbosstools/neon/stable/updates/integration-stack/
3.3.3 Update bpmn2 modeler site
          http://download.eclipse.org/bpmn2-modeler/updates/neon/1.3.2/
3.3.4 Update gef-sdk
                    https://hudson.eclipse.org/gef/job/gef4-maintenance/lastSuccessfulBuild/      /artifact/update-site/
3.3.5 Update drools-jbpm plugins…
         http://downloads.jboss.org/jbpm/release/6.5.0.Final/updatesite/

4.0 Install MySQL and configuration

4.1 To download and install mysql in your local machine, please type the following commands and type one by one in sequence...
  • wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
  • yum install mysql-community-release-el7-5.noarch.rpm
  • yum install mysql-server
  • mysql --version
4.2 Update mysql config file….
[root@localhost /]# vi /etc/my.cnf
[mysqld]
lower_case_table_names=1
character-set-server=utf8
collation-server=utf8_general_c
4.3 Start mysql, type the following command and enter..
       systemctl start mysqld
4.4 To check your mysql server status, please type the following and enter.
       systemctl status mysqld
4.5 Login to your newly installed mysql server using the following command and follow the commands for jbpm schema creation.
          mysql -u root -p
mysql> CREATE DATABASE jbpm;
mysql> use jbpm;
mysql> source /home/psingaram/Downloads/jbpm-installer/db/ddl-scripts/mysql5/mysql5-jbpm-schema.sql
mysql> source /home/psingaram/Downloads/jbpm-installer/db/ddl-scripts/mysql5/quartz_tables_mysql.sql
the above listed sql fils will be available from the following link...
https://github.com/kiegroup/jbpm/tree/master/jbpm-installer/src/main/resources/db/ddl-scripts/mysql5

5.0 Install WildFly 10.1.0.Final Application Server

5.1 Type the following command in your terminal and type the following command and enter
[root@localhost jbpm]# wget http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.zip
5.2 Unzip WildFly into your local development home folder



5.3 Update hibernate.4.3.11 module
5.4 Update mysql module in WildFly server and configure mysql datasource
  • Navigate to your installed WildFly configuration folder..
             SERVER_HOME/standalone/configuration
  • Open the standalone-full.xml and locate the datasources subsystem (<subsystem xmlns="urn:jboss:domain:datasources:1.1">) and add the following subsystem for mysql
    <subsystem xmlns="urn:jboss:domain:datasources:1.1">
    <datasources>
    <datasource jndi-name="java:jboss/datasources/jbpmDS" pool-name="jbpmDS" enabled="true" use-java-context="true">
    <connection-url>jdbc:mysql://localhost:3306/jbpm</connection-url>
    <driver>mysql</driver>
    <security>
     <user-name>{username}</user-name>
     <password>{password}</password>
     </security>
     </datasource>
     <drivers>
    <driver name="mysql" module="com.mysqldatabase.mysql">
     <driver-class>com.mysql.jdbc.Driver</driver-class> 
     <xa-datasource-class>
      com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
    </xa-datasource-class>
    </driver>
    </drivers>
    </datasources>
    </subsystem>

  • Navigate to SERVER_HOME/modules/system/layers/base/com
  • Create folder mysqldatabase/mysql/main (eg,SERVER_HOME/modules/system/layers/base/com/mysqldatabase/mysql/main)

  • Create module.xml file with following data

  • Download mysql jdbc driver (eg,mysql-connector-java-5.1.38-bin.jar) and put into this ((SERVER_HOME/modules/system/layers/base/com/mysqldatabase/mysql/main)) location.


6.0 Install KIE Workbench (kie-wb) on WildFly 10.1.0.Final Application Server and configuration

6.1 Download jBPM workbench (kie-wb) and rename to downloaded war file into kie-wb.war
[root@localhost jbpm]# wget https://repository.jboss.org/nexus/content/groups/public-jboss/org/kie/kie-wb-distribution-wars/6.5.0.Final/kie-wb-distribution-wars-6.5.0.Final-wildfly10.war

6.1 Unpack the war file in a temp folder, 

navigate to SERVER_HOME/standalone/deployments/business-central.war/WEB-INF


6.2 Open jboss-deployment-structure.xml and add the following line
<module name="com.mysqldatabase.mysql" export="true" services="import" meta-inf="import"/>

6.3 Move to SERVER_HOME/standalone/deployments/business-central.war/WEB-INF/classes/META-INF

6.4 Open persistence.xml, update the datasource name, make sure this is the same name you created in the standalone-full.xml datasource name
    <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
6.5 Replace the default h2 dialect information with the following code
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
...
</properties>

6.7 Now re-create the war file (repack) from the unpacked , modified files,
                                  jar -cvf kie-wb *
 6.8 Navigate to Wildfly 10.1.0.Final/standalone/deployment folder,
6.9 Copy the created kie-wb.war and paste into deployment folder

7.0 Install dashboard on WildFly 10.1.0.Final Application Server and configuration

7.1 Download dashboard
[root@localhost jbpm]# wget https://repository.jboss.org/nexus/content/groups/public-jboss/org/jbpm/dashboard/jbpm-dashboard-distributions/6.5.0.Final/jbpm-dashboard-distributions-6.5.0.Final-wildfly10.war
7.2 Rename the downloaded war file into dashboard.war
7.1 Move to SERVER_HOME/standalone/deployments/dashbuilder.war/WEB-INF
6.7 Open jboss-deployment-structure.xml and add the the following code..
<deployment>
  <dependencies>
<module name="com.mysqldatabase.mysql" export="true" services="import" meta-inf="import"/>
.
..
 </dependencies>
<deployment>
6.8 Open jboss-web.xml and update the jndi name, make sure this is the same name you created in the standalone.xml datasource name in step6 ...
    <jndi-name>java:jboss/datasources/jbpmDS</jndi-name>
6.9 Make sure you save those above mentioned files as you modified.
6.10 Now, navigate to your Server_Home/standalone.configuration folder and open standalone-full.xml file and update the system properties as follows..what we are trying to do here is , jBPM by default creates the those git and kie repo in server bin folder, but maintenance purpose we are moving out of the server and store in in user home.
<system-properties>
<property name="org.kie.demo" value="${org.kie.demo:false}"/>
<property name="org.kie.example" value="${org.kie.example:false}"/>
<property name="org.uberfire.nio.git.dir" value="/home/psin/jbpmrepo" />
<property name="org.uberfire.metadata.index.dir" value="/home/username1/jbpmrepo" />
<property name="org.guvnor.m2repo.dir" value="/home/username/jbpmrepo" />
</system-properties>
6.11 At this point your are done with all the settings, this is the time to test your installation
6.12 Navigate to SERVER_HOME/bin/ folder, type the following command to start the WildFly sever in standalone-full mode
    SERVER_HOME/bin/./standalone.sh – c standalone-full.xml
6.13 Open your browser and enter the following url..
             http://localhost:8080/kie-wb/

6.14 Enter user Id/ Password


7.0 Integrating eclipse neon with jBPM Workbench (kie-wb)

Log in to kie workbench (kie-wb) and create a sample jbpm project, build and deploy.Open your eclipse neon IDE, clone the git repository from kie-wb workbench. From the cloned git repo, import the git project into java workspace, since git is version control system, you can able to check-out, edit save and check-in into git. Those modification will be updated in kie-wb. Modification done in kie-wb side will be available in eclipse vice versa.

Please watch the below youtube video for detailed instructions....
https://youtu.be/qimrdgROMQQ

    ---thanks for reading---



2 comments:

  1. very good explanation, do you still working with JBPM? or switch to other engine
    is it possible to be integrated with IOS/android apps

    ReplyDelete
    Replies
    1. Possible to help publish guideline of websphere installation?

      Delete