jBPM Weblogic

    Finally I got jBPM deployed successfully on Weblogic 9.2. Thanks to "Maciej Swiderski" and "HuiSheng Xu" for their timely help and suggestions. I am also very much thankful to my company CrossCountry Infotech for supporting my efforts.


    I used Weblogic 9.2, jBPM 4.4, Mysql 5 and Eclipse 3.5 combination. I would suggest you to install Weblogic Eclipse plug-in. That will help you to edit some of the Weblogic configuration xmls.


    I am assuming that you have downloaded and installed Weblogic 9.2, Mysql 5.

    Pre Deployment Activities

    We need to create two shared libraries for Weblogic, one for jBPM core jars and one for BIRT jars. Instead of creating the shared libraries you can put the said jars on classpath but I would recommend the shared library approach.


    The shared library approach will give us control over loading required classes from our package if same are conflicting with Weblogic provided classes.  All the required configuration xmls (jBPM, hibernate, mail and logging) can be bundled as jar and placed in above mentioned jBPM core library.

    Library Creation

    jBPM Configuration Library

    Create a Jar with following files and name it, jbpm-cfg.jar

    1. jbpm.cfg.xml
    2. jbpm.hibernate.cfg.xml
    3. jbpm.mail.properties
    4. logging.properties


    All the above mentioned files are attached with this article. To set the respective values please refer to jBPM developer handbook (jBPM in J2EE environment) or user guide documentation.


    jBPM Core Shared Library Creation

    Create an EAR project in Eclipse named as “jBPMCoreLibrary”. Add following jars to APP-INF/lib directory. You will find all the jars in { jbpm.home }/lib directory

    1. activation.jar
    2. antlr.jar
    3. antlr-runtime.jar
    4. bsh.jar
    5. cglib.jar
    6. commons-collections.jar
    7. commons-logging.jar
    8. dom4j.jar
    9. drools-api.jar
    10. drools-core.jar
    11. drools-compiler.jar
    12. freemarker.jar
    13. gwt-console-rpc.jar
    14. gwt-console-server-integration.jar
    15. hibernate-core.jar
    16. janino.jar
    17. javassist.jar
    18. jaxb-api.jar
    19. jaxb-impl.jar
    20. jbpm.jar
    21. jbpm-console-form-plugin.jar
    22. jbpm-console-integration.jar
    23. jbpm-console-graphView-plugin.jar
    24. joda-time.jar
    25. jsr173_1.0_api.jar
    26. jta.jar
    27. juel-api.jar
    28. juel-engine.jar
    29. juel-impl.jar
    30. livetribe-jsr223.jar
    31. log4j.jar
    32. mail.jar
    33. mvel2.jar
    34. slf4j-api.jar
    35. slf4j-jdk14.jar
    36. jbpm-cfg.jar (Created Above)


    Create one dynamic web project, “jBPMCoreLibraryWeb” and add it to the above created EAR project. This is to resolve the error in EAR project, “A Java EE Enterprise Application must contain one or more modules in application.xml”

     


    Once you are done with above EAR creation edit the “weblogic-application.xml” and add following lines to it inside </wls:weblogic-application> element.  It is in “META-INF” directory of the EAR project.


    <wls:prefer-application-packages>
              <wls:package-name>org.mozilla.javascript.*</wls:package-name>
              <wls:package-name>org.mozilla.classfile.*</wls:package-name>
    </wls:prefer-application-packages>
    


    This is to avoid the js.jar conflict. Please refer to this link for more details. http://wiki.eclipse.org/BIRT/FAQ/Deployment#Q:_How_do_I_install_BIRT_in_WebLogic_10.0


     

    BIRT Shared Library

    Similarly we need to create the BIRT shared library. Create an EAR project for the same and name it as, “jBPMBIRTLibrary”.

    Add following jars to APP-INF/lib directory of that EAR project.

    1. chartengineapi.jar
    2. com.ibm.icu_3.8.1.v20080530.jar
    3. commons-cli-1.0.jar
    4. coreapi.jar
    5. crosstabcoreapi.jar
    6. dataadapterapi.jar
    7. dataaggregationapi.jar
    8. dataextraction.jar
    9. dteapi.jar
    10. engineapi.jar
    11. flute.jar
    12. js.jar
    13. modelapi.jar
    14. modelodaapi.jar
    15. odadesignapi.jar
    16. org.apache.commons.codec_1.3.0.v20080530-1600.jar
    17. org.eclipse.emf.common_2.4.0.v200902171115.jar
    18. org.eclipse.emf.ecore.xmi_2.4.1.v200902171115.jar
    19. org.eclipse.emf.ecore_2.4.2.v200902171115.jar
    20. org.w3c.css.sac_1.3.0.v200805290154.jar
    21. scriptapi.jar


    You will find all the jars in ReportEngine/lib directory. This is the extracted directory of “report-engine.zip” and can be found in  { jbpm.home }/lib directory.


    Create one dynamic web project, “jBPMBIRTLibraryWeb” and add it to the above created EAR project. This is to resolve the error in EAR project, “A Java EE Enterprise Application must contain one or more modules in application.xml”

     


    Once you are done with above EAR creation edit the “weblogic-application.xml” and add following lines to it inside </wls:weblogic-application> element.  It is in “META-INF” directory of the EAR project.


    <wls:prefer-application-packages>
              <wls:package-name>org.mozilla.javascript.*</wls:package-name>
              <wls:package-name>org.mozilla.classfile.*</wls:package-name>
    </wls:prefer-application-packages>
    

    BIRT Installation

    Create a directory named “serverDirForBirt” inside the Weblogic domain directory. Create one more directory named “birt” inside it.


    Now unzip the {jbpm.home }/lib/report-engine.zip into that directory. Remove all the jars from the unzipped ReportEngine/lib directory. Those jars are included in the above BIRT Shared Library.

     

    Unzip {jbpm.home }/lib/jbpm-console-reports.jar into the same directory.


    Set “-Dorg.jbpm.report.engine.dir” java options in serverDirForBirt\birt {Weblogic_domain_dir/bin/}setDomainEnv.cmd/sh file.

    e.g. -Dorg.jbpm.report.engine.dir=C:\bea923\user_projects\domains\Int_domain\serverDirForBirt\birt

    jBPM Console Application

    Import “gwt-console-jbpm.war” and “gwt-console-server-jbpm.war” into eclipse. (Can be found  in {jbpm.home } /lib)

     

    Rename them to,

    gwt-console-jbpm => jbpm-console

    gwt-console-server-jbpm. => gwt-console-server


    Add the “weblogic.xml” in the WEB-INF directory of “gwt-console-server” project and add the following lines to it.


    <weblogic-web-app>
         <security-role-assignment>
             <role-name>administrator</role-name>
             <principal-name>jBPMAdmin</principal-name>
         </security-role-assignment>
    </weblogic-web-app>
    


     

    You can map the roles in web.xml with your principle names configured in Weblogic. Please refer to the "Security Configuration" section of this article for more details on roles. Here I have mapped only “administrator” role. There are two more roles “manager” and “user”. You can map them as per your choice.


    We will deploy the console WARs as part of EAR. So create a third EAR project named, “jBPMConsoleApp”.  Add above two web projects to this EAR project viz. jbpm-console and gwt-console-server.


    The console application requires some jars from jBPM core library so make them available by adding following tags in Weblogic-application.xml of this EAR.

     

     

    <wls:library-ref>
            <wls:library-name>jBPM-Core-Library</wls:library-name>
            <wls:specification-version>4.4</wls:specification-version>
            <wls:exact-match>false</wls:exact-match>
        </wls:library-ref>
        <wls:library-ref>
            <wls:library-name>jBPM-BIRT-Library</wls:library-name>
            <wls:specification-version>1.0</wls:specification-version>
            <wls:exact-match>false</wls:exact-match>
        </wls:library-ref>
    

     


    Once you are done with the above EAR creation edit the “weblogic-application.xml” and add following lines to it inside </wls:weblogic-application> element.  It is in “META-INF” directory of the EAR project.


    
    <wls:prefer-application-packages>
              <wls:package-name>org.mozilla.javascript.*</wls:package-name>
              <wls:package-name>org.mozilla.classfile.*</wls:package-name>
    </wls:prefer-application-packages>
    

    Database Schema

    Execute Mysql scripts and create the database named “jbpm4”. The scripts for mysql can be found in, “{jbpm.home }\install\src\db\create” directory with name, jbpm.mysql.create.sql.


    You can load the sample users and data by using script, example.identities.sql  located at,

    {jbpm.home }\ install\src\demo.


     

    Start Weblogic Server....

    Configurations On Weblogic

    Datasource Creation On Weblogic

    Create Mysql datasource on Weblogic with following name, jBPM DS and JNDI name, “JbpmDS”. You can choose any data source name but JNDI name should be “JbpmDS”.


    Security Roles Configuration On Weblogic

    We have now come to the final configuration. This is the security roles configuration on Weblogic.


    Create a new “Authentication Providers” of type SQL Authenticator.


    Provide following values to the given fields.

    Navigation in Weblogic Console, Home >  Summary of Security Realms >  myrealm >  Providers


     

    Field

    Value

    Name

    jBPMAuth

    Control   Flag

    SUFFICIENT

    Data   Source Name

    jBPM DS   (Created Above)

    Plaintext   Passwords Enabled

    True

    SQL Get Users Password

    SELECT   PASSWORD_ FROM JBPM4_ID_USER WHERE ID_=?

    SQL User Exists

    SELECT ID_ FROM   JBPM4_ID_USER WHERE ID_ = ?

    SQL List Users

    SELECT ID_   FROM JBPM4_ID_USER WHERE ID_ LIKE ?

    SQL List Groups

    SELECT ID_ FROM   JBPM4_ID_GROUP WHERE ID_ LIKE ?

    SQL Group Exists

    SELECT ID_   FROM JBPM4_ID_GROUP WHERE ID_ = ?

    SQL Is Member

    SELECT u.ID_ FROM   JBPM4_ID_MEMBERSHIP m, JBPM4_ID_USER u, JBPM4_ID_GROUP g  WHERE g.ID_ = ? AND u.ID_ = ? AND m.GROUP_   = g.DBID_ AND m.USER_ = u.DBID_

    SQL List Member Groups

    SELECT   g.ID_ FROM JBPM4_ID_MEMBERSHIP m, JBPM4_ID_USER u, JBPM4_ID_GROUP g  WHERE u.ID_ = ? AND m.GROUP_ = g.DBID_ AND   m.USER_ = u.DBID_

    SQL Get User Description (If you   check the “Descriptions Supported” box)

    SELECT GIVENNAME_ FROM   JBPM4_ID_USER WHERE ID_ = ?

    SQL Get Group Description (If   you check the “Descriptions Supported” box)

    SELECT   TYPE_ FROM JBPM4_ID_GROUP WHERE ID_ = ?

     


    P.S. Please check the cases of table names if it does not work on Linux.


    You need to restart the Weblogic server...


    You can verify the configuration success using following navigation. Home >  Summary of Security Realms >  myrealm >  Users and Groups


    It should show something like Figure 1. These are the users inserted by example.identities.sql.

     

         Figure 1

    users_list.PNG

     


     

    Deploying created libraries and application

    Now we are ready to deploy the above created entities.

    1.       jBPMCoreLibrary.ear

    2.       jBPMBIRTLibrary.ear

    3.       jBPMConsoleApp.ear

     

    Deploy the first two EARs, jBPMCoreLibrary.ear and jBPMBIRTLibrary.ear as library on Weblogic. The third should be deployed as application. Your deployments will look as shown in below diagram.

    deployments.PNG


    Try http://localhost:7001/jbpm-console/app.html and start building powerful applications in jBPM which can run on Weblogic.

     

    For the applications running on that server to use the jBPM refer to above jBPMCoreLibrary from that application.


     

     

    Reference Links:

    http://community.jboss.org/thread/152527

    http://community.jboss.org/thread/153405

    http://community.jboss.org/thread/152589

     

    You can use this URL to access the console app,

     

    http://localhost:8080/jbpm-console

     

    You have to write the client code to create jbpm process instance or tasks or add users.

     

    See if this helps,

     

    http://docs.jboss.org/jbpm/v5.4/userguide/ch.quickstarts.html