Yes, I think I face that before. The problem is that you need to define the variables in the process definition with the correct type.<br>Can you try with that and get back with that?<br><br><br><div class="gmail_quote">On Mon, Oct 19, 2009 at 12:52 PM, Bill Tarr <span dir="ltr"><<a href="mailto:javatestcase@yahoo.com">javatestcase@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">This seems more like a bug, I thought I'd post it here, but point me to the JIRA if I need to enter an issue.<br>
<br>
Still testing out JPAVariablePersister. It appears the session, processes, and variables are persisted. However, when I try to load the session again, and reopen the process as follows, I get a ClassCastException.<br>
<br>
StatefulKnowledgeSession session = JPAKnowledgeService.loadStatefulKnowledgeSession( 1, knowledgeBase, null, env );<br>
ProcessInstance processClm = session.getProcessInstance(1);<br>
<br>
The second line (ClaimsDemoJpaTest.java:182) is the source of the stack trace below. The error makes sense, as:<br>
<br>
ForEachNodeInstance extends CompositeNodeInstance<br>
CompositeContextNodeInstance extends CompositeNodeInstance<br>
<br>
So they clearly cannot be cast to each other, but I'm not of how to troubleshoot this beyond that. The line of code throwing the error clearly expects to be able to cast the nodeInstance.<br>
<br>
restoreVariable(variableInfo, parentIds, variableName, (CompositeContextNodeInstance) nodeInstance);<br>
<br>
Here is the stack:<br>
<br>
java.lang.ClassCastException: org.drools.workflow.instance.node.ForEachNodeInstance cannot be cast to org.drools.workflow.instance.node.CompositeContextNodeInstance<br>
at org.drools.persistence.processinstance.ProcessInstanceInfo.restoreVariable(ProcessInstanceInfo.java:198)<br>
at org.drools.persistence.processinstance.ProcessInstanceInfo.restoreVariables(ProcessInstanceInfo.java:166)<br>
at org.drools.persistence.processinstance.ProcessInstanceInfo.getProcessInstance(ProcessInstanceInfo.java:144)<br>
at org.drools.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:62)<br>
at org.drools.common.AbstractWorkingMemory.getProcessInstance(AbstractWorkingMemory.java:1720)<br>
at org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:261)<br>
at org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:29)<br>
at org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:12)<br>
at org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:254)<br>
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getProcessInstance(CommandBasedStatefulKnowledgeSession.java:92)<br>
at com.csatp.svc.rulesmgr.claim.ClaimsDemoJpaTest.validateDocumentWorkflow2(ClaimsDemoJpaTest.java:182)<br>
<br>
Obviously this is a flow with a ForEach node. The ForEach calls a subflow for each item in the List claim.roles, in my test case, there are 2 subflows.<br>
<br>
I don't know if it helps, but here is the forEach node from the flow:<br>
<br>
<forEach id="2" name="ForEach" x="423" y="62" width="200" height="150" variableName="role" collectionExpression="claim.roles" ><br>
<nodes><br>
<subProcess id="1" name="Document Workflow" x="36" y="40" width="132" height="48" processId="DocumentWorkflow2" ><br>
<mapping type="in" from="role" to="role" /><br>
</subProcess><br>
</nodes><br>
<connections><br>
</connections><br>
<in-ports><br>
<in-port type="DROOLS_DEFAULT" nodeId="1" nodeInType="DROOLS_DEFAULT" /><br>
</in-ports><br>
<out-ports><br>
<out-port type="DROOLS_DEFAULT" nodeId="1" nodeOutType="DROOLS_DEFAULT" /><br>
</out-ports><br>
</forEach><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br> - <a href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br> - <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br> - Salatino "Salaboy" Mauricio -<br>