Pages

Sunday, March 24, 2013

Testing Activiti BPM on WebLogic 12c

Activiti is a great open source workflow + BPM platform, which you can use in your own java application (embedded) or test it in the provided Rest or Web demo applications. Activiti also provides  an Eclipse designer plugin which you can use to create your own BPMN 2.0 definitions and export this to the Activiti applications.

In blogpost I will show you the steps how to get this working on the WebLogic 12c JEE container and in Oracle Enterprise Pack for Eclipse as IDE.

First step is to download OEPE , Coherence and WebLogic 12c and install WebLogic with OEPE.

Next step is to start Eclipse and create a workspace.
After the initial eclipse setup, we can add the Activiti designer plugin to Eclipse. Go to Help menu and Install New Software
Use http://activiti.org/designer/update/ as value in the Work with field and select Activiti BPMN Designer


Finish the installation.

Download Activiti ( I used 5.12 version ) and extract the zip.

We need to update the WebLogic Jackson Core and Mapper JSON jars so these matches with the two demo application wars ( else you get some jackson reporting errors )

cp ../activiti-5.12/wars/activiti-explorer/WEB-INF/lib/jackson-core-asl-1.9.9.jar /Oracle/Middleware12.1/modules/org.codehaus.jackson.core.asl_1.1.0.0_1-8-3.jar

cp ../activiti-5.12/wars/activiti-explorer/WEB-INF/lib/jackson-mapper-asl-1.9.9.jar /Oracle/Middleware12.1/modules/org.codehaus.jackson.mapper.asl_1.1.0.0_1-8-3.jar

Now we can add a new server to your Eclipse workspace and create a new WebLogic domain.

For the Rest Activiti demo which uses its own basic authentication we need to disable the WebLogic authentication interception. You can do this by opening the config.xml of the WebLogic domain in an editor and add
<enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials> just above the end tab of the security-configuration element


Next steps is to extract the two demo applications. This way we can deploy these wars as WebLogic exploded folders. Now we can easily change the Activiti configuration files without making new wars ( change what you like and restart WebLogic server).


The demo activiti-explorer and activiti-rest applications need to have its own repository database , I will use MySQL ( tried Oracle as database but this will give me a lot of SQL group by and Month , Year errors ).

Here are my MySQL statements.

create database activiti;
create database activiti2;

create user 'activiti'@'%' identified by 'activiti';
grant all on activiti.* to 'activiti'@'%';
grant all on activiti2.* to 'activiti'@'%';

create user 'activiti'@'localhost' identified by 'activiti';
grant all on activiti.* to 'activiti'@'localhost';
grant all on activiti2.* to 'activiti'@'localhost';

mysql activiti -u activiti -pactiviti < ../activiti-5.12/database/create/activiti.mysql.create.engine.sql
mysql activiti -u activiti -pactiviti < ../activiti-5.12/database/create/activiti.mysql.create.history.sql
mysql activiti -u activiti -pactiviti < ../activiti-5.12/database/create/activiti.mysql.create.identity.sql

mysql activiti2 -u activiti -pactiviti < ../activiti-5.12/database/create/activiti.mysql.create.engine.sql
mysql activiti2 -u activiti -pactiviti < ../activiti-5.12/database/create/activiti.mysql.create.history.sql
mysql activiti2 -u activiti -pactiviti < ../activiti-5.12/database/create/activiti.mysql.create.identity.sql


Next we can update the db.properties file in activiti-explorer/web-inf/classes folder

db=mysql
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/activiti?autoReconnect=true
jdbc.username=activiti
jdbc.password=activiti

Also update the db.properties file of the activit-rest application also in /web-inf/classes folder

db=mysql
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/activiti2?autoReconnect=true
jdbc.username=activiti
jdbc.password=activiti


Deploy these exploded web applications to WebLogic.


After a successful deployment of these two application we can shutdown the WebLogic container so we can disable the second time demo data generation. ( the rest demo application does not have demo data )

For this we need to update the activiti-standalone-context.xml in activiti-explorer/web-inf/classes 
put these demoDataGenerator entries to false

  <bean id="demoDataGenerator" class="org.activiti.explorer.demo.DemoDataGenerator" init-method="init">
    <property name="processEngine" ref="processEngine" />
    <property name="createDemoUsersAndGroups" value="false" />
    <property name="createDemoProcessDefinitions" value="false" />
    <property name="createDemoModels" value="false" />
    <property name="generateReportData" value="false" />
  </bean>

Startup WebLogic and so we can test the demo applications.


Go to http://localhost:7001/activiti-explorer
use kermit as username / password



Go to Vacation request proces and click Start Process




Complete the Form


The manager must approve




Claim and complete the task


Optionally look at the activity reports.



Or manage the repository.





For the Rest Activiti demo application we first need to fill the user, groups tables.

 Add an admin record to act_id_group



Add the kermit user


Assign admin group to the kermit user


Next steps we can test the rest services

I will use the Advanced Rest Client plugin of Google Chrome browser.

First check the login of the kermit user



Next step is to retrieve the kermit user details.
We need to provide Authorization: Basic HTTP Header property with kermit:kermit as value in base64 encoding




The last part is the Activiti Designer in Eclipse.

Create an Activiti Project and after that import or add an Activiti Diagram.



Open the BPMN process


Design your process.


Export your process from the Package Explorer.


Upload the generated bar export file to the activi-explorer application or to the rest application ( use basic authentication, upload the bar file and use application/x-www-form-urlencoded as Content-Type )


I also greated a LDAP module so you can use Activiti with a LDAP repository as Active Directory, OpenLDAP or the internal WebLogic LDAP.

https://github.com/biemond/activiti


ldap groups with admin and user as cn have security-role as type
rest of the group are automatically jave assignment as type
requires the following jars
activiti-engine-5.12.jar
ldap-client-api-0.1.jar
shared-all-0.9.18.jar


That's all.

8 comments:

  1. Hi, I'm glad we're not the only ones interested in Activiti on WL 12c

    One of the other things you might want to look into in that Activiti by default uses Java SE thread pool to manage job threads which n not welcomed in Java EE application servers such as WL

    The issue and one of the solutions using commonj WorkManager is described here: http://forums.activiti.org/en/viewtopic.php?f=6&t=3523

    Note that even though post is about web sphere, it is also relevant for WL as they share commonj workmanager API

    Hope this helps,
    Andrey

    ReplyDelete
    Replies
    1. Hi,

      Thanks for this forum post, great suggestion. I will test it myself and update this blogpost.

      cheers

      Delete
  2. I prefer Oracle BPM and it run on WL12c too!!

    ReplyDelete
  3. Hey guys.

    Wanted to let you know that I got camunda BPM running on WLS 12c (camunda BPM is a fork of Activiti, see http://www.bpm-guide.de/2013/03/18/camunda-forks-activiti-and-launches-camunda-bpm/).

    See http://camundabpm.blogspot.de/2013/05/camunda-bpm-70-on-weblogic-12c.html

    Here we use a real container integration via JCA - hence we run fully Java EE compliant without special hacks and have the engine available as container service. By doing this you deploy the engine once on the server and can have multiple deployments using it or containing process definitions (compare that to the central JPA provider).

    Would love to hear feedback on this.

    Cheers
    Bernd

    P.S @Anonymous: I think camunda BPM/Activiti have a pretty different target that Oracle BPM. We do a roadshow together with Oracle to work that out - unfortunately only in Germany: http://camundabpm.blogspot.de/2013/05/camunda-vs-oracle-shootout-roadshow.html

    ReplyDelete
    Replies
    1. Hi,

      Impressive, the Java EE integration is very nice.
      good luck with the roadshow.

      Delete
  4. Is Activiti the open-source alternative to Oracle BPM Suite...?
    And if it is so lightweight BPM engine, isn't good that Tomcat is good enough instead of Weblogic.

    Will Activiti work with Tomcat..?

    Is there any comparitive study to list advandatage and disadvantage of Oracle BPM Suite and Activiti

    ReplyDelete
    Replies
    1. Hi,

      No it is not the same, Oracle is much more complete but Activiti can have enough functionality for you or you can use it embedded in your own application.

      and yes it probably works on tomcat.

      Thanks

      Delete
  5. Dear Edwin
    I have been going through all your blogs to find out that how to pass Authorization header with value = Basic Yw377jbkjbaiudjuo3u== while doing an HTTP POST using HTTP Bindings adapter
    where,
    Yw377jbkjbaiudjuo3u== represents Base64Encoded combination of username and password separated by colon(:) [username:password]
    I followed your blog to specify the Properties in composite.xml and MyBPEL.bpel but it seems to be not working for me.
    I saw this post of yours(though my query is not related to BPM) and I could see some hope of help as you too have used Authorization through REST Client App.
    Can you please guide me how to achieve the same from HTTP Bindings adapter, I have almost lost hope and would deeply appreciate your help

    ReplyDelete