JBoss Community

Could not find work item handler

created by Tobias Wittur in jBPM - View the full discussion

Hi,

 

I am trying to send a message through an intermediate message throw event. However, I ve got troubles registering a work item handler for this.

 

I had a look at the test case in the junit example package testMessageIntermediateThrow().

 

I copied the Meta-Inf folder in my own project and created my own workItemHandler. I basically just copied the intermediateEvent xml into my bpmn file.

 

http://community.jboss.org/servlet/JiveServlet/downloadImage/2-620260-16853/244-287/project+structure.PNG

 

The error I get is:

 

Caused by: java.lang.RuntimeException: unable to execute Action

Caused by: org.drools.WorkItemHandlerNotFoundException: Could not find work item handler for Send Task

 

Send Task was the old workItemHandler (in the example), the new one would be MyServiceTaskHandler:

 

Under Eclipse -> Properties, Action for this intermediateThrowEvent I found this:

 

org.drools.process.instance.impl.WorkItemImpl workItem = new org.drools.process.instance.impl.WorkItemImpl();
workItem.setName("Send Task");

 

If I change this to:

org.drools.process.instance.impl.WorkItemImpl workItem = new org.drools.process.instance.impl.WorkItemImpl();
workItem.setName("MyServiceTaskHandler");

It changes it back immediately. So where exactly is that fetched

 

 

This is the work definition:

 

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

[
  [
    name : MyServiceTask,
    parameters : [
        Message : new StringDataType()
    ],
    displayName : MyServiceTask,
    icon : icons/arrowright.GIF
  ]
]

 

 

This the java in my processTest:

 

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("StartProcessWithMessage.bpmn2"), ResourceType.BPMN2);
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
 
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.getWorkItemManager().registerWorkItemHandler("MyServiceTask", new MyServiceTaskHandler());

 

 

Thx for your help.

 

Tobi

Reply to this message by going to Community

Start a new discussion in jBPM at Community