0 Replies Latest reply on Nov 16, 2016 12:26 AM by leon v

    Creating a repository of custom Java components in JBPM is not working correctly

    leon v Newbie

      What I'm trying to do sounds simple:

      - Create a repository of java components that can be used in a workflow.


      Creating the repository and loading the new components works nicely! here is the content of MyWork.wid:


      import org.drools.core.process.core.datatype.impl.type.StringDataType;



          "name" : "Twitter",

          "description" : "Send a twitter message",

          "parameters" : [

            "Message" : new StringDataType()


          "displayName" : "MyWork",

          "eclipse:customEditor" : "org.drools.eclipse.flow.common.editor.editpart.work.SampleCustomEditor",

          "icon" : "icons/twitter.gif",

          "category" : "Communication",

          "defaultHandler" : "com.sample.MyWorkItem",

          "documentation" : "index.html",

          "dependencies" : [





      The component shows up in my "custom task" section and I can drag it onto the diagram.

      I'm using Eclipse plugin and version JBPM 6.5.0.Final


      I'm creating a diagram with Start -> MyWork -> end, and I see the following issues :


      1. The class name com.sample.MyWorkItem  , but this class name is nowhere to be found in the .bpmn file.


      2. When I try to edit this task, I only see "Description" and "I/O Parameters" tab. Nothing that allows me to correct the missing java class.


      3. Even When I'm creating "Service task" and specify the class name, This class is never instantiated when executing the process .

      All documentation tells me is that I have to Manually register my components using :ksession.getWorkItemManager().registerWorkItemHandler("MyWorkName", new MyWorkItem());

      This doesn't make any sense to me.

      If I can create the entire workflow, with conditions, sub processes etc, why would I be forced to write 1 single line of java code for every component I'm going to use?

      There should be a way that JBPM creates the workitemHandlers either during the creation of the session, or the first time a workItemHandler is actually called. Neither happens.


      Even if the session can tell me all the work items that are defined, I can do a lookup and create the workitemsHandlers myself, but there is no such interface.

      I hope I'm missing something here.


      This would make the use of JBPM so much easier and really could remove a lot of coding, building and deploying after every change in the workflow.


      I hope someone can point me in the right direction!





      Below is the .bpmn file that just contains my workItem, yet no class name

      <?xml version="1.0" encoding="UTF-8"?>

      <bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" xmlns="http://www.jboss.org/drools" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd" id="Definitions_1" targetNamespace="http://www.jboss.org/drools">

        <bpmn2:itemDefinition id="ItemDefinition_1" structureRef="StringDataType"/>

        <bpmn2:process id="evaluation" drools:version="1" drools:packageName="defaultPackage" drools:adHoc="false" name="Default Process" isExecutable="true">

          <bpmn2:startEvent id="StartEvent_1" name="">



          <bpmn2:sequenceFlow id="SequenceFlow_1" drools:priority="1" name="" sourceRef="StartEvent_1" targetRef="Task_1"/>

          <bpmn2:endEvent id="EndEvent_1" name="">



          <bpmn2:task id="Task_1" drools:taskName="Twitter" drools:displayName="MyWork" drools:icon="icons/twitter.gif" name="Twitter">



            <bpmn2:ioSpecification id="_InputOutputSpecification_32">

              <bpmn2:dataInput id="_DataInput_58" itemSubjectRef="ItemDefinition_1" name="Message"/>

              <bpmn2:inputSet id="_InputSet_33" name="New Input Set">



              <bpmn2:outputSet id="OutputSet_1" name="Output Set 1"/>


            <bpmn2:dataInputAssociation id="_DataInputAssociation_58">




          <bpmn2:sequenceFlow id="SequenceFlow_2" drools:priority="1" sourceRef="Task_1" targetRef="EndEvent_1"/>


        <bpmndi:BPMNDiagram id="BPMNDiagram_1" name="Default Process Diagram">

          <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="evaluation">

            <bpmndi:BPMNShape id="BPMNShape_1" bpmnElement="StartEvent_1">

              <dc:Bounds height="36.0" width="36.0" x="100.0" y="100.0"/>


            <bpmndi:BPMNShape id="BPMNShape_2" bpmnElement="EndEvent_1">

              <dc:Bounds height="36.0" width="36.0" x="500.0" y="100.0"/>


            <bpmndi:BPMNShape id="BPMNShape_Task_1" bpmnElement="Task_1">

              <dc:Bounds height="50.0" width="110.0" x="245.0" y="155.0"/>


            <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="BPMNShape_1" targetElement="BPMNShape_Task_1">

              <di:waypoint xsi:type="dc:Point" x="118.0" y="136.0"/>

              <di:waypoint xsi:type="dc:Point" x="118.0" y="180.0"/>

              <di:waypoint xsi:type="dc:Point" x="245.0" y="180.0"/>


            <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="BPMNShape_Task_1" targetElement="BPMNShape_2">

              <di:waypoint xsi:type="dc:Point" x="355.0" y="180.0"/>

              <di:waypoint xsi:type="dc:Point" x="518.0" y="180.0"/>

              <di:waypoint xsi:type="dc:Point" x="518.0" y="136.0"/>