Yes.. I will do it, this weekend probably.<br>Greetings<br><br><div class="gmail_quote">On Mon, Oct 19, 2009 at 6:09 PM, Kris Verlaenen <span dir="ltr"><<a href="mailto:kris.verlaenen@cs.kuleuven.be">kris.verlaenen@cs.kuleuven.be</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 indeed seems to be am easy-to-fix bug, where the code is assuming<br>
the node instance is a CompositeContextNodeInstance, while casting it to<br>
a NodeInstanceContainer should have been sufficient (and that way the<br>
ForEachNodeInstance would have been accepted as well).<br>
<br>
Mauricio, could you change the cast to NodeInstanceContainer and add a<br>
test case to the junit tests for this as well?<br>
<br>
Thx,<br>
Kris<br>
<div><div></div><div class="h5"><br>
Quoting Bill Tarr <<a href="mailto:javatestcase@yahoo.com">javatestcase@yahoo.com</a>>:<br>
<br>
> ok, I uploaded a demo to:<br>
><br>
> <a href="https://jira.jboss.org/jira/browse/JBRULES-2304" target="_blank">https://jira.jboss.org/jira/browse/JBRULES-2304</a><br>
><br>
><br>
><br>
><br>
> ________________________________<br>
> From: Mauricio Salatino <<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>><br>
> To: Rules Users List <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
> Sent: Mon, October 19, 2009 2:42:41 PM<br>
> Subject: Re: [rules-users] [droolsflow] JPAVariablePersister -<br>
> ClassCastException on ForEachNodeInstance<br>
><br>
> Can you upload with the jira issue an isolated test?<br>
><br>
><br>
><br>
> On Mon, Oct 19, 2009 at 1:55 PM, Mauricio Salatino<br>
> <<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>> wrote:<br>
><br>
> Hmm I see.. that's another problem related with variable hierarchies<br>
> inside the context.<br>
> >Because you are using a variable inside a node that contains a<br>
> nested context, probably there is a problem when the algorithm looks<br>
> for nested context.. I need to review that.. can you open a Jira<br>
> Issue and assign it to me? (Mauricio Salatino)<br>
> ><br>
> ><br>
> ><br>
> ><br>
> >2009/10/19 Bill Tarr <<a href="mailto:javatestcase@yahoo.com">javatestcase@yahoo.com</a>><br>
> ><br>
> >I think I have the variables covered, and no changes to the class<br>
> hierarchies (and the flows work without persistenence still). <br>
> >><br>
> >>My variable Claim is declared in the top level process as<br>
> com.csatp.svc.rulesmgr.claim.Claim, my variable Role is declared in<br>
> the subprocess as com.csatp.svc.rulesmgr.claim.Role.<br>
> >><br>
> >>The stack got buried in my overly long original post, here it is:<br>
> >><br>
> >><br>
> >>java.lang.ClassCastException:<br>
> org.drools.workflow.instance.node.ForEachNodeInstance cannot be cast<br>
> to org.drools.workflow.instance.node.CompositeContextNodeInstance<br>
> >> at<br>
><br>
org.drools.persistence.processinstance.ProcessInstanceInfo.restoreVariable(ProcessInstanceInfo.java:198)<br>
> >> at<br>
><br>
org.drools.persistence.processinstance.ProcessInstanceInfo.restoreVariables(ProcessInstanceInfo.java:166)<br>
> >> at<br>
><br>
org.drools.persistence.processinstance.ProcessInstanceInfo.getProcessInstance(ProcessInstanceInfo.java:144)<br>
> >> at<br>
><br>
org.drools.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:62)<br>
> >> at<br>
><br>
org.drools.common.AbstractWorkingMemory.getProcessInstance(AbstractWorkingMemory.java:1720)<br>
> >> at<br>
><br>
org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:261)<br>
> >> at<br>
><br>
org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:29)<br>
> >> at<br>
><br>
org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:12)<br>
> >> at<br>
><br>
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:254)<br>
> >> at<br>
><br>
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getProcessInstance(CommandBasedStatefulKnowledgeSession.java:92)<br>
> >> at<br>
><br>
com.csatp.svc.rulesmgr.claim.ClaimsDemoJpaTest.validateDocumentWorkflow2(ClaimsDemoJpaTest.java:182)<br>
> >><br>
> >><br>
> >><br>
> >> <br>
> >><br>
> >><br>
> >><br>
> ________________________________<br>
> From: Mauricio Salatino <<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>><br>
> >>To: Rules Users List <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
> >>Sent: Mon, October 19, 2009 1:40:37 PM<br>
> >><br>
> >>Subject: Re: [rules-users] [droolsflow] JPAVariablePersister -<br>
> ClassCastException on ForEachNodeInstance<br>
> >><br>
> >><br>
> >>I'm trying to remember what's the problem..<br>
> >>But for what I remember it could be something like:<br>
> >>you define the variable claim with type<br>
> com.csatp.svc.rulesmgr.claim.Claim<br>
> >><br>
> >>did you change the variable type, for example adding a new variable<br>
> from a different type into the claim variable?<br>
> >><br>
> >>if not, can you post the stack trace about the class cast<br>
> exception?<br>
> >>to know about from which class is trying to cast...<br>
> >><br>
> >><br>
> >><br>
> >><br>
> >><br>
> >>2009/10/19 Bill Tarr <<a href="mailto:javatestcase@yahoo.com">javatestcase@yahoo.com</a>><br>
> >><br>
> >>Could you clarify what you mean by defining the variables?<br>
> >>><br>
> >>>Are you referring to the header variable definitions?<br>
> >>><variables><br>
> >>><variable name="claim" ><br>
> >>><type<br>
> name="org.drools.process.core.datatype.impl.type.ObjectDataType"<br>
> className="com.csatp.svc.rulesmgr.claim.Claim" /><br>
> >>></variable><br>
> >>></variables> <br>
> >>>If so, could you clarify what should be added?<br>
> >>><br>
> >>><br>
> >>><br>
> >>><br>
> >>><br>
> ________________________________<br>
> From: Mauricio Salatino <<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>><br>
> >>>To: Rules Users List <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
> >>>Sent: Mon, October 19, 2009 12:59:51 PM<br>
> >>>Subject: Re: [rules-users] [droolsflow] JPAVariablePersister -<br>
> ClassCastException on ForEachNodeInstance<br>
> >>><br>
> >>><br>
> >>>Yes, I think I face that before. The problem is that you need to<br>
> 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>
> >>><br>
> >>>On Mon, Oct 19, 2009 at 12:52 PM, Bill Tarr<br>
> <<a href="mailto:javatestcase@yahoo.com">javatestcase@yahoo.com</a>> wrote:<br>
> >>><br>
> >>>This seems more like a bug, I thought I'd post it here, but point<br>
> me to the JIRA if I need to enter an issue.<br>
> >>>><br>
> >>>>Still testing out JPAVariablePersister. It appears the session,<br>
> processes, and variables are persisted. However, when I try to load<br>
> the session again, and reopen the process as follows, I get a<br>
> ClassCastException.<br>
> >>>><br>
> >>>> StatefulKnowledgeSession session =<br>
> JPAKnowledgeService.loadStatefulKnowledgeSession( 1, knowledgeBase,<br>
> null, env );<br>
> >>>> ProcessInstance processClm = session.getProcessInstance(1);<br>
> >>>><br>
> >>>>The second line (ClaimsDemoJpaTest.java:182) is the source of the<br>
> 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<br>
> to troubleshoot this beyond that. The line of code throwing the<br>
> error clearly expects to be able to cast the nodeInstance.<br>
> >>>><br>
> >>>> restoreVariable(variableInfo, parentIds,<br>
> variableName, (CompositeContextNodeInstance) nodeInstance);<br>
> >>>><br>
> >>>>Here is the stack:<br>
> >>>><br>
> >>>>java.lang.ClassCastException:<br>
> org.drools.workflow.instance.node.ForEachNodeInstance cannot be cast<br>
> to org.drools.workflow.instance.node.CompositeContextNodeInstance<br>
> >>>> at<br>
><br>
org.drools.persistence.processinstance.ProcessInstanceInfo.restoreVariable(ProcessInstanceInfo.java:198)<br>
> >>>> at<br>
><br>
org.drools.persistence.processinstance.ProcessInstanceInfo.restoreVariables(ProcessInstanceInfo.java:166)<br>
> >>>> at<br>
><br>
org.drools.persistence.processinstance.ProcessInstanceInfo.getProcessInstance(ProcessInstanceInfo.java:144)<br>
> >>>> at<br>
><br>
org.drools.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:62)<br>
> >>>> at<br>
><br>
org.drools.common.AbstractWorkingMemory.getProcessInstance(AbstractWorkingMemory.java:1720)<br>
> >>>> at<br>
><br>
org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:261)<br>
> >>>> at<br>
><br>
org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:29)<br>
> >>>> at<br>
><br>
org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:12)<br>
> >>>> at<br>
><br>
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:254)<br>
> >>>> at<br>
><br>
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getProcessInstance(CommandBasedStatefulKnowledgeSession.java:92)<br>
> >>>> at<br>
><br>
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<br>
> subflow for each item in the List claim.roles, in my test case, there<br>
> are 2 subflows.<br>
> >>>><br>
> >>>>I don't know if it helps, but here is the forEach node from the<br>
> flow:<br>
> >>>><br>
> >>>><forEach id="2" name="ForEach" x="423" y="62" width="200"<br>
> height="150" variableName="role" collectionExpression="claim.roles" ><br>
> >>>><nodes><br>
> >>>><subProcess id="1" name="Document Workflow" x="36" y="40"<br>
> 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"<br>
> nodeInType="DROOLS_DEFAULT" /><br>
> >>>></in-ports><br>
> >>>><out-ports><br>
> >>>><out-port type="DROOLS_DEFAULT" nodeId="1"<br>
> 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>
> >>>><br>
> >>><br>
> >>><br>
> >>>--<br>
> >>>- <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>
> >>>- <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>
> >>>- Salatino "Salaboy" Mauricio -<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>
> >>><br>
> >>><br>
> >><br>
> >><br>
> >>--<br>
> >>- <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>
> >>- <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>
> >>- Salatino "Salaboy" Mauricio -<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>
> >><br>
> >><br>
> ><br>
> ><br>
> >--<br>
> >- <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>
> >- <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>
> >- Salatino "Salaboy" Mauricio -<br>
> ><br>
><br>
><br>
> --<br>
> - <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>
> - <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>
> - Salatino "Salaboy" Mauricio -<br>
><br>
><br>
><br>
><br>
<br>
<br>
<br>
<br>
</div></div>Disclaimer: <a href="http://www.kuleuven.be/cwis/email_disclaimer.htm" target="_blank">http://www.kuleuven.be/cwis/email_disclaimer.htm</a><br>
<div><div></div><div class="h5">_______________________________________________<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>
</div></div></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>