Embedding JBPM 4.3 in a Grails 1.2.2 Application

14 / May / 2010 by Himanshu Seth 10 comments


In one of our projects, we had a requirement for using some existing Business Process Management tool. JBPM is one such tool that we are evaluating.

Our first step was to run a “Hello World” process from inside the grails application. On searching over the internet, I didn’t find any helpful article/blog on integrating JBPM inside a grails application. However, there were some very good resources on integrating JBPM with a spring application. I found Joram Barrez’s Hello World Example very helpful and was able to integrate using the following steps:

  1. Download jbpm from here.
  2. Unzip the contents and copy the jbpm.jar file to the lib directory of your application.  The exploded directory has the following files/ folders for version 4.3 :
  3. Also copy the mail.jar from the jbpm installation directory (${jbpmHome}/lib) to the lib directory of your application.
  4. Create a process descriptor file in the conf directory (helloWorld.jpdl.xml) with the following code
  5. Create a class in src/groovy
    package com.jbpm.example
    class Printer {
     public void printHelloWorld() {
       System.out.println("&nbsp;&nbsp; HELLO WORLD!");
  6. Create a minimal jBPM config (jbpm.cfg.xml) in the conf directory
  7. Create a basic Hibernate config called conf/jbpm.hibernate.cfg.xml(I’m using MySql, Still looking for a way on how to use the grails DataSource)
  8. Create the following Spring beans is resources.groovy
    springHelper(org.jbpm.pvm.internal.processengine.SpringHelper) {
            jbpmCfg = "jbpm.cfg.xml"
  9. Now lets deploy this process. To deploy a process we will need to inject the processEngine bean
     def processEngine;

    The code to deploy this process is

    RepositoryService repositoryService = processEngine.getRepositoryService();
  10. Lets start an instance of this service :
    ExecutionService executionService = processEngine.getExecutionService();

    This will execute the printHelloWorld method of the Printer class as configured in the process description file.

Hope you find this useful. We are still working on executing more complex processes and will keep posting our learnings.

Your feedback and suggestions are welcome.

~~Himanshu Seth~~



Tag -

Grails JBPM

comments (10)

  1. appoggiato

    La verità è che la maggioranza delle ƿersone al mondo dispone Ԁі սn ene poco allenato е sottο-valutato.

  2. mudou

    greate start point!:>

    i walk througth the example and find some errors. however, i solve it finally!

    error 1: Class not found: javax/script/ScriptEngineManager
    solved: copy ${jbpmHome}/lib/livetribe-jsr223.jar to the lib directory of your application.

    error 2: Class org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor can not access a member of class com.jbpm.example.Printer with modifiers “”
    solved: Make the class public. eg: public class Printer{…}

  3. aziz

    Does anyone has a working example for the item below using Grails and JBPM ?
    Workflow with :
    a) Safe forms and Assign Tasks
    b) Reassign Tasks
    c) Forward Tasks after they are done
    d) Email notification
    e) Enable/ Suspended Tasks
    f) Generate Summary of Tasks in Pipeline
    g) Generate history of completed task


  4. fabien


    No need to install previous version of the jbpm plugin.
    Forget my previous post. It is working.


  5. fabien

    I do have the following issue when jbpm.cfg.xml is unchanged from plugin install.

    2010-06-22 19:01:49,976 [main] ERROR [localhost].[/JbpmHelloWorld2] – Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngine’: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [protected org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is java.lang.NullPointerException

    And i do have the followiong issue when adding the imports in jbpm.cfg.xml.

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘jbpmTemplate’: Cannot resolve reference to bean ‘jbpmConfiguration’ while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘jbpmConfiguration’: Invocation of init method failed; nested exception is org.jbpm.JbpmException: no ObjectInfo class specified for element ‘import’

    Could anybody help me ?

    I believe that it should be fine to put steps 9 and 10 in a grails Service.

  6. sanjeev

    I resolved the issues where my grails-app keeps restarting.. This was because on of my classes in the src/groovy had improper package declaration. – Some how grails throws no error and keeps restarting the app.

    Now the only question i have is where do we put the code in step 9 and step 10.. Do they go in the Bootstrap on in spring beans?

  7. sanjeev

    Thank you so much for putting this documentation up. I am at my wits-end and completely disappointed with the lack of documentation for jbpm integration with grails.

    I am trying to integrate grails 1.2.2 with jbpm 4.3 on jdk 1.5

    I am having trouble running this example as my grails app keeps restarting. I have a feeling hibernate layer keeps dropping the connection. would you by any chance know why?.

    Also Could you please SPECIFY where step 9 and step 10 go. Where should we put that code in Bootstrap or Controller. One of the readers before has asked this question as well.

    I have looked all over jbpm website and found nothing.


  8. himanshu

    Hi fan,
    Sorry I was not able to get to your comment earlier. I have updated the post to include the screenshot of the unziped contents of the jbpm4.3 zip file.


Leave a Reply

Your email address will not be published. Required fields are marked *