Gettings started with JBoss jBPM5

In my journey through all the modules of Drools (Expert, Fusion, Planner), I also visit jBPM (fomerly known as Drools Flow). In this tutorial we just get started with Netbeans and a simple hello world project and focusing on the basics, such as required libraries and running within the Netbeans IDE.
Netbeans is not as close to the BPM community as Eclipse, there is no plugin available, the SOA project is abandoned (I guess). But using Netbeans as our IDE, I will not move over to Eclipse, but see how I can run and debug with Netbeans but still use some Eclipse features.

About BPMN:

The JBoss engine execute BPMN files, we can create this files manually or using one of the visual tools. For the basic understanding you should create a simple BPMN by hand to learn a bit about the notation.

Lets create the most simple BPM flow possible:



  • Create a simple java application HellojBPM5

    New java application

  • Add the library files from the previous project, as well the additional jBPM5 libraries
    – jbpm-bpmn2-5.2.0.Final.jar
    – jbpm-flow-builder-5.2.0.Final.jar
    – jbpm-flow-5.2.0.Final.jar


  • Create a bpmn file
    The most simple process consisting of nothing but a start and end-event and a simple task (script).

    <?xml version="1.0" encoding="UTF-8"?>
    <definitions id="Definition"
                 xsi:schemaLocation=" BPMN20.xsd"
      <process processType="Private" isExecutable="true" id="demo.jbpm5.hello" name="Hello World" >
        <!-- nodes -->
        <startEvent id="_1" name="StartProcess" />
        <scriptTask id="_2" name="Say Hello" >
          <script>System.out.println("Hello World!");</script>
        <endEvent id="_3" name="EndProcess" >
        <!-- connections -->
        <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
        <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
  • Create/Update the main class to read the bpmn file and execute as a process
    I recommend reading the core API chapter of the user manual which describes very well the methods.

    package hellojbpm5;
    import org.drools.KnowledgeBase;
    import org.drools.builder.KnowledgeBuilder;
    import org.drools.builder.KnowledgeBuilderFactory;
    import org.drools.builder.ResourceType;
    import org.drools.runtime.StatefulKnowledgeSession;
    public class HellojBPM5 {
        public static void main(String[] args) {
            KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
            kbuilder.add(ResourceFactory.newClassPathResource("/hellojbpm5/hellojbpm5.bpmn",HellojBPM5.class), ResourceType.BPMN2);
            KnowledgeBase kbase = kbuilder.newKnowledgeBase();
            StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
  • Runthe application / process

    Project Structure

    Execute process


  • More complex process descriptions
  • Use of a visual editor
  • Further interaction with the process, parameter, etc

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s