<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
<table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
<h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
<!-- To have a header image/logo replace the name below with your img tag -->
<!-- Email clients will render the images when the message is read so any image -->
<!-- must be made available on a public server, so that all recipients can load the image. -->
<a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
jBPM Console Server can't find WorkItem Handler Implementation
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/theom3ga">José Tomás Tocino</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/799582#799582">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi there.</p><p>  </p><p>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.</p><p>  </p><p>First I create the work item in drools-guvnor, it is called 'Activo1', and it's defined as follows:</p><p>  </p><p>import org.drools.process.core.datatype.impl.type.ObjectDataType;</p><p>import org.drools.process.core.datatype.impl.type.StringDataType;</p><p>  </p><p>[</p><p>    [</p><p>    "name" : "Activo1",</p><p>    "parameters" : [</p><p>              "MyFirstParam" : new StringDataType(),</p><p>    ],</p><p>    "results" : [</p><p>        "Result" : new StringDataType()</p><p>    ],</p><p>    "displayName" : "My Task",</p><p>    "icon" : "",</p><p>  ]</p><p><span style="font-size: 10pt;">]</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Next, I edit the conf/META-INF/CustomWorkItemHandlers.conf so it looks like this:</p><p>[</p><p>  "Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),</p><p>  "Activo1": new defaultPackage.Activo1()</p><p>]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>For the implementation, I created a folder called 'defaultPackage' and, inside, I create an Activo1.java file with the following contents:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>package defaultPackage;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import org.drools.runtime.process.*;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>public class Activo1 implements WorkItemHandler{</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {</p><p>        System.out.println("GOOD BYE WORLD");</p><p>        manager.completeWorkItem(workItem.getId(), null);</p><p>    }</p><p>    </p><p>    public void abortWorkItem (WorkItem workItem, WorkItemManager manager) {</p><p>        // Nothing</p><p>    } </p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>In order to compile it, I use</p><p>javac -cp "runtime/lib/*" defaultPackage/Activo1.java</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>And in order to create the JAR file I use this:</p><p>jar cfe Activo1.jar defaultPackage.Activo1 defaultPackage</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The previous two commands may be the part that's wrong, because I'm an absolute java noob.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I copy the JAR file in all the 'lib' folders I come across, namely $installer/lib, $installer/runtime/lib and $installer/jboss[...]/standalone/lib. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>When I launch the process in the jbpm console, I get the following error in the SERVER.LOG file:</p><p>Could not commit session: org.jbpm.workflow.instance.WorkflowRuntimeException: [defaultPackage.Proceso1:4 - My Task:2] -- Could not find work item handler for Activo1</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>HOWEVER, If I change the CustomWorkItemHandlers.conf file so it looks like this:</p><p>[</p><p>  "Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),</p><p>  "Activo1": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler()</p><p>]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>and then I launch the process, the default SystemOut work item handler works OK and I get the following in the LOG file:</p><p>[stdout] (http-localhost-127.0.0.1-8080-1) Executing work item WorkItem 5 [name=Activo1, state=0, processInstanceId=5, parameters{TaskName=Activo1}]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Please help!</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/799582#799582">going to Community</a></p>
<p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>