Could not find work item handler
tob1as Aug 10, 2011 2:43 AMHi,
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.
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 to Send Task immediately when I run the processTest.java. 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