<!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;">
    Re: How to get WorkItemHandler results
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/eaa">Esteban Aliverti</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/719789#719789">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p><blockquote class="jive-quote"><span style="color: #555555; font-family: 'Lucida Sans', 'Lucida Sans Unicode', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12px; background-color: #eef4f9;">The application I'm making makes the interaction with the user through the web designer. Therefore I'll need to run the process definition in a Servlet. As such I'm startin the process within the Servlet and the WorkItemHandler will be returning information to be sent to the user. As such isn't this the only way to do it? Because executeWorkItem is void I can't send it to the Servlet...right?</span></blockquote></p><p>The WorkItemHanlder always returns information to the process. If you map the return of your Handler to a process variable, you can get the value of that variable right after you do session.startProcess() (assuming there is no intermediate wait-state before your Work Item). So, the process will start, it will exectue the WI Handler, the Handler will create the result and complete the WI (passing the result) the result will be map to a process variable (because you explicitly defined this mapping) and then, the process will continue until it reaches a wait-state or an End Event Node. At this point, the control will be returned to your servlet where you can read the pocess variable value.</p><p>There are possibly more than 100 other ways to do this same thing. Pass some listener to the WI Handler that will be invoked when the result is ready, use JMS to communicate the Handler and your code, etc. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"><p style="background-color: #eef4f9; font-size: 12px; color: #555555; font-family: 'Lucida Sans', 'Lucida Sans Unicode', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;">My other one is the web app is running in jBoss and although there shoudln't e problems mixing jBpm and jBoss web I'm having some troubles. I get: </p><p style="background-color: #eef4f9; font-size: 12px; color: #555555; font-family: 'Lucida Sans', 'Lucida Sans Unicode', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;">java.lang.ClassNotFoundException: org.drools.runtime.process.WorkItemHandler </p><p style="background-color: #eef4f9; font-size: 12px; color: #555555; font-family: 'Lucida Sans', 'Lucida Sans Unicode', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;">When deploying the application. What can I do?</p></blockquote><p>Which dependencies are you defining in your app? You should also include some of the drools dependencies:&#160; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;groupId&gt;org.drools&lt;/groupId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;artifactId&gt;knowledge-api&lt;/artifactId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;version&gt;5.4.0-SNAPSHOT&lt;/version&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;type&gt;jar&lt;/type&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;groupId&gt;org.drools&lt;/groupId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;artifactId&gt;drools-core&lt;/artifactId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;version&gt;5.4.0-SNAPSHOT&lt;/version&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;groupId&gt;org.drools&lt;/groupId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;artifactId&gt;drools-compiler&lt;/artifactId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;version&gt;5.4.0-SNAPSHOT&lt;/version&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;groupId&gt;org.jbpm&lt;/groupId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;artifactId&gt;jbpm-bpmn2&lt;/artifactId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;version&gt;5.3.0-SNAPSHOT&lt;/version&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;groupId&gt;org.jbpm&lt;/groupId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;artifactId&gt;jbpm-flow&lt;/artifactId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;version&gt;5.3.0-SNAPSHOT&lt;/version&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;dependency&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;groupId&gt;org.jbpm&lt;/groupId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;artifactId&gt;jbpm-flow-builder&lt;/artifactId&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;version&gt;5.3.0-SNAPSHOT&lt;/version&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/dependency&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Best Regards,</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/719789#719789">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>