<!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;">
    HornetQTaskHandler Issue
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/roxy1987">roxy1987</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/797093#797093">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p><span style="color: #000080;"><strong>Hi,</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="color: #000080;"><strong> </strong></span>&#160;</p><p><span style="color: #000080;"><strong>I picked the human task war file from jbpm-installer and deployed it in websphere server after making some changes to persistence.xml. The following is what the persistence.xml in the human task war looks like. Starting up websphere starts the human task service.</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span class="jive-xml-tag" style="color: #333333;"></span> &#160;</p><p><p><p><div><span class="jive-xml-tag"> </span></div></p><span class="jive-xml-tag"></span></p><span class="jive-xml-tag"></span></p><p><span class="jive-xml-tag"><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</span>
<span class="jive-xml-tag"><span>&lt;persistence version="1.0" xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" rel="nofollow" target="_blank">http://java.sun.com/xml/ns/persistence</a><span> </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" rel="nofollow" target="_blank">http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd</a><span>
</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/orm" rel="nofollow" target="_blank">http://java.sun.com/xml/ns/persistence/orm</a><span> </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" rel="nofollow" target="_blank">http://java.sun.com/xml/ns/persistence/orm_1_0.xsd</a><span>" xmlns:orm="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/orm" rel="nofollow" target="_blank">http://java.sun.com/xml/ns/persistence/orm</a><span>" xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" rel="nofollow" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>" xmlns="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" rel="nofollow" target="_blank">http://java.sun.com/xml/ns/persistence</a><span>"&gt;</span></span>
&#160; <span class="jive-xml-tag">&lt;persistence-unit name="org.jbpm.task"&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;provider&gt;</span>org.hibernate.ejb.HibernatePersistence<span class="jive-xml-tag">&lt;/provider&gt;</span>&#160;&#160;&#160;&#160; 
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;mapping-file&gt;</span>META-INF/Taskorm-JPA2.xml<span class="jive-xml-tag">&lt;/mapping-file&gt;</span>
&#160;&#160;&#160; 
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Attachment<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.BooleanExpression<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Comment<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Content<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Deadline<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Delegation<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.EmailNotification<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.EmailNotificationHeader<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Escalation<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Group<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.I18NText<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Notification<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.OnAllSubTasksEndParentEndStrategy<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.PeopleAssignments<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Reassignment<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Status<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.SubTasksStrategy<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.Task<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.TaskData<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jbpm.task.User<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;properties&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.DB2Dialect"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.connection.driver_class" value="com.ibm.db2.jcc.DB2Driver"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.connection.url" value="jdbc:db2://localhost:50000/jbpm5" /&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.connection.username" value="S28249"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.connection.password" value="tyagiS"/&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.DB2Dialect"/&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.max_fetch_depth" value="3"/&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.show_sql" value="false" /&gt;</span>&#160; 
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" /&gt;</span>
&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-comment">&lt;!-- BZ 841786: AS7/EAP 6/Hib 4 uses new (sequence) generators which seem to cause problems --&gt;</span>&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernate.id.new_generator_mappings" value="false" /&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/properties&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/persistence-unit&gt;</span>
<span class="jive-xml-tag">&lt;/persistence&gt;</span>

 
</code></pre></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="color: #333333;"><span class="jive-xml-tag"></span></span> &#160;</p><p><span style="color: #333333;"><span class="jive-xml-tag"><strong style="color: #000080;">Then I start the process like following : </strong></span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="color: #333333;"><span class="jive-xml-tag"></span></span> &#160;</p><p><span style="color: #333333;"><span class="jive-xml-tag"><strong style="color: #000080;"></strong></span></span><p><span style="color: #333333;"><span class="jive-xml-tag"><strong style="color: #000080;"></strong></span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="color: #333333;"><span class="jive-xml-tag"></span></span>&#160;</p><p><span style="color: #333333;"><span class="jive-xml-tag"><strong style="color: #000080;">It starts a process but it doesnot assign the task to the user. It just creates a process instance and the first task remains in CREATED state. But it should be in RESERVED state.</strong></span></span></p><p><span style="color: #333333;"><span class="jive-xml-tag"><strong style="color: #000080;">COuld anyone help me here please.</strong></span></span></p><p><span style="color: #333333;"><span class="jive-xml-tag"><strong style="color: #000080;">Thanks.</strong></span></span></p></p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>public</b></font> <font color="navy"><b>void</b></font> initiateProcess(String processName, String processDefId) <font color="navy"><b>throws</b></font> Exception
 <font color="navy">{</font>
&#160;&#160; StatefulKnowledgeSession ksession = BpmRepositoryConfig.createSession(processName);
&#160; KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, <font color="red">"test"</font>, 1000);
&#160; HornetQHTWorkItemHandler humanTaskHandler = <font color="navy"><b>new</b></font> HornetQHTWorkItemHandler(ksession);
&#160; humanTaskHandler.setIpAddress(ipAddress);
&#160; humanTaskHandler.setPort(port);
&#160; ksession.getWorkItemManager().registerWorkItemHandler(<font color="red">"Human Task"</font>, humanTaskHandler);
&#160; JPAWorkingMemoryDbLogger logger2 = <font color="navy"><b>new</b></font> JPAWorkingMemoryDbLogger(ksession);
&#160;&#160;&#160;&#160; ProcessInstance processInstance = ksession.startProcess(processDefId);
&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>long</b></font> processInstanceId = processInstance.getId();
&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(<font color="red">"Process Started : "</font>+processInstanceId);
&#160; logger.close();
&#160; logger2.dispose();
 <font color="navy">}</font>
<font color="navy"><b>public</b></font> <font color="navy"><b>static</b></font> <font color="navy"><b>void</b></font> readKnowledgeBase(String processName) <font color="navy"><b>throws</b></font> Exception
 <font color="navy">{</font>
&#160; <font color="navy"><b>try</b></font>
&#160; <font color="navy">{</font>
&#160;&#160; <font color="navy"><b>if</b></font>(kbase == <font color="navy"><b>null</b></font>)
&#160;&#160; <font color="navy">{</font>
&#160;&#160;&#160; ProcessBuilderFactory.setProcessBuilderFactoryService(<font color="navy"><b>new</b></font> ProcessBuilderFactoryServiceImpl());
&#160;&#160;&#160; ProcessMarshallerFactory.setProcessMarshallerFactoryService(<font color="navy"><b>new</b></font> ProcessMarshallerFactoryServiceImpl());
&#160;&#160;&#160; ProcessRuntimeFactory.setProcessRuntimeFactoryService(<font color="navy"><b>new</b></font> ProcessRuntimeFactoryServiceImpl());
&#160;&#160;&#160; BPMN2ProcessFactory.setBPMN2ProcessProvider(<font color="navy"><b>new</b></font> BPMN2ProcessProviderImpl());
&#160;&#160;&#160; KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
&#160;&#160;&#160; 
&#160;&#160;&#160; kbuilder.add(ResourceFactory.newClassPathResource(processName), ResourceType.BPMN2);
&#160;&#160; <font color="navy">}</font>
&#160; <font color="navy">}</font>
&#160; <font color="navy"><b>catch</b></font>(Exception e)
&#160; <font color="navy">{</font>
&#160;&#160; BpmExceptionHandler.handleException(e);
&#160; <font color="navy">}</font>
 <font color="navy">}</font>
 
 
 <font color="navy"><b>public</b></font> <font color="navy"><b>static</b></font> StatefulKnowledgeSession createSession(String processName) <font color="navy"><b>throws</b></font> Exception
 <font color="navy">{</font>
&#160; KnowledgeSessionConfiguration config = <font color="navy"><b>null</b></font>;
&#160; readKnowledgeBase(processNames);
&#160; EntityManagerFactory emf = Persistence.createEntityManagerFactory( <font color="red">"org.jbpm.persistence.jpa"</font> );
&#160; Environment env = KnowledgeBaseFactory.newEnvironment();
&#160; <font color="navy"><b>try</b></font>
&#160; <font color="navy">{</font>&#160; 
&#160;&#160; env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
&#160;&#160; env.set( EnvironmentName.GLOBALS, <font color="navy"><b>new</b></font> MapGlobalResolver() );&#160; 
&#160;&#160; Properties properties = <font color="navy"><b>new</b></font> Properties();
&#160;&#160; properties.put(<font color="red">"drools.processInstanceManagerFactory"</font>, <font color="red">"org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory"</font>);
&#160;&#160; properties.put(<font color="red">"drools.processSignalManagerFactory"</font>, <font color="red">"org.jbpm.persistence.processinstance.JPASignalManagerFactory"</font>);
&#160;&#160; config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
&#160; <font color="navy">}</font>
&#160; <font color="navy"><b>catch</b></font>(Exception e)
&#160; <font color="navy">{</font>
&#160;&#160; BpmExceptionHandler.handleException(e);
&#160; <font color="navy">}</font>
&#160; <font color="navy"><b>return</b></font> JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);
&#160;&#160; 
 <font color="navy">}</font>
&#160;
</code></pre></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/797093#797093">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>