<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><DIV>Could you clarify what you mean by defining the variables?</DIV>
<DIV> </DIV>
<DIV>Are you referring to the header variable definitions?</DIV>
<DIV> </DIV><FONT size=2>
<P align=left><variables></P>
<P align=left><variable name="claim" ></P>
<P align=left><type name="<U>org</U>.drools.process.core.<U>datatype</U>.<U>impl</U>.type.ObjectDataType" className="<U>com</U>.<U>csatp</U>.<U>svc</U>.<U>rulesmgr</U>.claim.Claim" /></P>
<P align=left></variable></P>
<P></variables></P>
<P></FONT> </P>
<P>If so, could you clarify what should be added?</P>
<DIV><BR></DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 12pt"><BR>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><FONT size=2 face=Tahoma>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Mauricio Salatino <salaboy@gmail.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Rules Users List <rules-users@lists.jboss.org><BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Mon, October 19, 2009 12:59:51 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [rules-users] [droolsflow] JPAVariablePersister - ClassCastException on ForEachNodeInstance<BR></FONT><BR>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" rel=nofollow target=_blank ymailto="mailto:javatestcase@yahoo.com">javatestcase@yahoo.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>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" rel=nofollow target=_blank ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A href="https://lists.jboss.org/mailman/listinfo/rules-users" rel=nofollow target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR></BLOCKQUOTE></DIV><BR><BR clear=all><BR>-- <BR>- http://salaboy.wordpress.com<BR>- http://www.jbug.com.ar<BR>- Salatino "Salaboy" Mauricio -<BR></DIV></DIV></div><br>
</body></html>