How to Set Up JBPM with Liferay

Introduction #

JBoss jBPM is a powerful workflow and BPM engine that enables the creation of business processes that coordinate between people, applications and services. With its modular architecture, JBoss jBPM combines easy development of workflow applications with a flexible and scalable process engine. The JBoss jBPM process designer graphically represents the business process steps in order to facilitate a strong link between the business analyst and the technical developer.

Set Up #

Grab the starter kit from here:

http://labs.jboss.com/portal/jbossjbpm/downloads

I'll give you a quick set of instructions to help you get started. It sounds a little overwhelming but it's really easy once you become familiar with how the webapp works. It's also good because you end up with a workflow portlet that you can modify to do whatever you want and actually understand how it works. If you can get the WAR rebuilt, then you'll be a lot of that there. Here's how I began:

  1. Download jboss JBPM starter kit from the above link.
  2. Extract it somewhere, I put it under C:\jbpm-starters-kit-3.1.2 (I'll reference everything as from that directory for the rest of the steps)
  3. Take the WAR file C:\jbpm-starters-kit-3.1.2\jbpm-server\server\jbpm\deploy\jbpm.war and extract it somewhere to use as a project (this will give you all the JSPs, web.xml etx.).
  4. Then go and take the source tree from this directory C:\jbpm-starters-kit-3.1.2\jbpm\src\java.webapp and put it somewhere to use for starting webapp code.
  5. Next, in the jbpm.war that you extracted in a previous step, you'll want to delete the file jbpm-webapp-3.1.2.jar from the WEB-INF lib directory because that's the jar from the source files that you copied in step 4, so you don't need the jar anymore.
  6. The next thing to do is to setup a build script to package all this for you. I stripped down my maven2 pom.xml which you can use. It is setup for a JSF portlet and imports the lib files for JBPM .. if you use it, you'll have to manually import some of the JAR files. You can get more info on this from maven.apache.org.
  7. You also don't need the index.jsp or login.jsp files (JBPM fakes the logins) and have your portlet.xml point to the home.jsp file. You'll also want to comment this line in the task.jsp: <jbpm:processimage task="${taskBean.taskInstanceId}"/> because it doesn't work right, it'll just disable to image of the digrams that jbpm draws.
  8. You can find the config files you will want to include in the war possible and maybe modify: C:\jbpm-starters-kit-3.1.2\jbpm\src\config.files
  9. You also do not need the AuthenticationFilter class, I actually rewrote it to open and close my JBPMContext as a JSF PhaseListener. This helped me to work around transactional problems with MySQL .. that's a real easy thing to do. Also you then need to remove the JBPMContext variables from the source code, and get them from the rewritten AuthenticationFilter class (make static variable and getter to retrieve the context) you can just replace the references in the source that you copied to the authenticationfilter class and use that jbpm context. I think you only need to do that if you are using MySQL.
 <?xml version="1.0" encoding="UTF-8"?>
 <project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>sample.workflow</groupId>
  <artifactId>sample-workflow-portlet</artifactId>
  <packaging>war</packaging>
  <name>Sample Workflow Portlet</name>
  <version>1.0-SNAPSHOT</version>
  <developers>
    <developer>
      <id>whomever</id>
      <name>whomever</name>
      <email>whomever@whereever.com</email>
      <organization>My Org</organization>
    </developer>
  </developers>
  <pluginRepositories>
    <pluginRepository>
      <id>codehaus-plugins</id>
      <name>Codehaus Plugins</name>
      <url>http://dist.codehaus.org/</url>
      <snapshots>
      </snapshots>
      <releases>
      </releases>
    </pluginRepository>
    <pluginRepository>
      <id>codehaus-plugins-legacy</id>
      <name>Codehaus Plugins</name>
      <url>http://dist.codehaus.org/</url>
      <layout>legacy</layout>
      <snapshots>
      </snapshots>
      <releases>
      </releases>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>
    </plugins>
    <finalName>workflow-portlet</finalName>
  </build>
  <dependencies>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>5.1</version>
      <scope>test</scope>
      <classifier>jdk15</classifier>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.13</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>antlr</groupId>
      <artifactId>antlr</artifactId>
      <version>2.7.6</version>
    </dependency>
    <dependency>
      <groupId>asm</groupId>
      <artifactId>asm</artifactId>
      <version>1.5.3</version>
    </dependency>
    <dependency>
      <groupId>asm</groupId>
      <artifactId>asm-attrs</artifactId>
      <version>1.5.3</version>
    </dependency>
    <dependency>
      <groupId>bsh</groupId>
      <artifactId>bsh</artifactId>
      <version>1.3.0</version>
    </dependency>
    <dependency>
      <groupId>jboss</groupId>
      <artifactId>cglib</artifactId>
      <version>2.1_2jboss</version>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <version>1.6.1</version>
    </dependency>
    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
      <version>3.1</version>
    </dependency>
    <dependency>
      <groupId>commons-digester</groupId>
      <artifactId>commons-digester</artifactId>
      <version>1.5</version>
    </dependency>
    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>dom4j</groupId>
      <artifactId>dom4j</artifactId>
      <version>1.6.1</version>
    </dependency>
    <dependency>
      <groupId>net.sf.ehcache</groupId>
      <artifactId>ehcache</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>hibernate</groupId>
      <artifactId>hibernate</artifactId>
      <version>3.1</version>
    </dependency>
    <dependency>
      <groupId>jaxen</groupId>
      <artifactId>jaxen</artifactId>
      <version>1.1-beta-9</version>
    </dependency>
    <dependency>
      <groupId>jbpm</groupId>
      <artifactId>jbpm</artifactId>
      <version>3.1.2</version>
    </dependency>
    <dependency>
      <groupId>jbpm</groupId>
      <artifactId>jbpm-identity</artifactId>
      <version>3.1.2</version>
    </dependency>
    <dependency>
      <groupId>javax.sql</groupId>
      <artifactId>jdbc-stdext</artifactId>
      <version>2.0</version>
    </dependency>
    <!-- JSF dependencies -->
    <dependency>
      <groupId>jsf</groupId>
      <artifactId>jsf-api</artifactId>
      <version>2.4.1</version>
    </dependency>
    <dependency>
      <groupId>jsf</groupId>
      <artifactId>jsf-portlet</artifactId>
      <version>1.4.2_03-b02</version>
    </dependency>
    <dependency>
      <groupId>jsf</groupId>
      <artifactId>jsf-impl</artifactId>
      <version>2.4.1</version>
    </dependency>
    <dependency>
      <groupId>jsf</groupId>
      <artifactId>demo-components</artifactId>
      <version>1.1</version>
    </dependency>
    <!-- End JSF Dependencies -->
    <dependency>
      <groupId>portlet-api</groupId>
      <artifactId>portlet-api</artifactId>
      <version>1.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.j2ee</groupId>
      <artifactId>j2ee</artifactId>
      <version>1.4</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>myfaces</groupId>
      <artifactId>tomahawk</artifactId>
      <version>1.1.1</version>
    </dependency>
    <dependency>
      <groupId>com.liferay.portal</groupId>
      <artifactId>portal-ejb</artifactId>
      <version>4.2.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.liferay.portal</groupId>
      <artifactId>portal-service</artifactId>
      <version>4.2.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.liferay.portal</groupId>
      <artifactId>portal-kernel</artifactId>
      <version>4.2.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
 </project>

Related Articles #

How To's

0 Attachments
27803 Views
Average (0 Votes)
The average rating is 0.0 stars out of 5.
Comments
Threaded Replies Author Date
Air Jordan retro 11 : The Definition of... peter cai August 19, 2011 1:43 AM
As an alternate option, there's Aperte Workflow... Sean Champ June 30, 2012 7:44 AM

Air Jordan retro 11 : The Definition of Basketball Shoes
Posted on 8/19/11 1:43 AM.
As an alternate option, there's Aperte Workflow - available with JBPM support and integrates with Liferay: http://www.aperteworkflow.org/
- I've read about it, haven't installed it yet, looking forward to giving it a go
- Aperte Workflow provides portlets
- Aperte Workflow uses Vaadin - https://vaadin.com/home
- AFAIK, Aperte Workflow also integrates with Aperte Reports - http://code.google.com/p/aperte-reports/

Cheers.
Posted on 6/30/12 7:44 AM.