José Tomás Tocino [
https://community.jboss.org/people/theom3ga] created the discussion
"jBPM Console Server can't find WorkItem Handler Implementation"
To view the discussion, visit:
https://community.jboss.org/message/799582#799582
--------------------------------------------------------------
Hi there.
I'm having a problem trying to run a process that has a Work Item. The server
can't find the implementation for the Work Item Handler. These are the steps I
follow.
First I create the work item in drools-guvnor, it is called 'Activo1', and
it's defined as follows:
import org.drools.process.core.datatype.impl.type.ObjectDataType;
import org.drools.process.core.datatype.impl.type.StringDataType;
[
[
"name" : "Activo1",
"parameters" : [
"MyFirstParam" : new StringDataType(),
],
"results" : [
"Result" : new StringDataType()
],
"displayName" : "My Task",
"icon" : "",
]
]
Then, I create a simple process with a start event, the work item, and the end event. I
build a snapshot of the package and the process appears in the list of available processes
in the jbpm-console.
Next, I edit the conf/META-INF/CustomWorkItemHandlers.conf so it looks like this:
[
"Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),
"Activo1": new defaultPackage.Activo1()
]
I use ant stop.demo, and then ant start.demo, then I check in the console server war that
the CustomWorkItemHandlers file is properly updated. So far it's ok.
For the implementation, I created a folder called 'defaultPackage' and, inside, I
create an Activo1.java file with the following contents:
package defaultPackage;
import org.drools.runtime.process.*;
public class Activo1 implements WorkItemHandler{
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
System.out.println("GOOD BYE WORLD");
manager.completeWorkItem(workItem.getId(), null);
}
public void abortWorkItem (WorkItem workItem, WorkItemManager manager) {
// Nothing
}
}
In order to compile it, I use
javac -cp "runtime/lib/*" defaultPackage/Activo1.java
And in order to create the JAR file I use this:
jar cfe Activo1.jar defaultPackage.Activo1 defaultPackage
The previous two commands may be the part that's wrong, because I'm an absolute
java noob.
I copy the JAR file in all the 'lib' folders I come across, namely $installer/lib,
$installer/runtime/lib and $installer/jboss[...]/standalone/lib.
When I launch the process in the jbpm console, I get the following error in the SERVER.LOG
file:
Could not commit session: org.jbpm.workflow.instance.WorkflowRuntimeException:
[defaultPackage.Proceso1:4 - My Task:2] -- Could not find work item handler for Activo1
HOWEVER, If I change the CustomWorkItemHandlers.conf file so it looks like this:
[
"Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),
"Activo1": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler()
]
and then I launch the process, the default SystemOut work item handler works OK and I get
the following in the LOG file:
[stdout] (http-localhost-127.0.0.1-8080-1) Executing work item WorkItem 5 [name=Activo1,
state=0, processInstanceId=5, parameters{TaskName=Activo1}]
So the work item definition and the model definition seem to be OK. The problem seems to
be in the place or the way the JAR was generated.
Please help!
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/799582#799582]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]