Can you upload with the jira issue an isolated test?<br><br><br><div class="gmail_quote">On Mon, Oct 19, 2009 at 1:55 PM, Mauricio Salatino <span dir="ltr"><<a href="mailto:salaboy@gmail.com">salaboy@gmail.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;">Hmm I see.. that's another problem related with variable hierarchies inside the context.<br>
Because you are using a variable inside a node that contains a nested context, probably there is a problem when the algorithm looks for nested context.. I need to review that.. can you open a Jira Issue and assign it to me? (Mauricio Salatino) <br>
<div><div></div><div class="h5">
<br><br><div class="gmail_quote">2009/10/19 Bill Tarr <span dir="ltr"><<a href="mailto:javatestcase@yahoo.com" target="_blank">javatestcase@yahoo.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt;"><div>I think I have the variables covered, and no changes to the class hierarchies (and the flows work without persistenence still). </div>
<div> </div>
<div>My variable Claim is declared in the top level process as com.csatp.svc.rulesmgr.claim.Claim, my variable Role is declared in the subprocess as com.csatp.svc.rulesmgr.claim.Role.</div>
<div> </div>
<div>The stack got buried in my overly long original post, here it is:</div><div>
<div> </div>
<div>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>
</div>
<div> </div>
<div><br> </div>
</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 face="Tahoma" size="2"><div>
<hr size="1">
<b><span style="font-weight: bold;">From:</span></b> Mauricio Salatino <<a href="mailto:salaboy@gmail.com" target="_blank">salaboy@gmail.com</a>><br><b><span style="font-weight: bold;">To:</span></b> Rules Users List <<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>><br>
</div><b><span style="font-weight: bold;">Sent:</span></b> Mon, October 19, 2009 1:40:37 PM<div><div></div><div><br><b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] [droolsflow] JPAVariablePersister - ClassCastException on ForEachNodeInstance<br>
</div></div></font><div><div></div><div><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 <font size="+0"><font size="2"><u>com</u>.<u>csatp</u>.<u>svc</u>.<u>rulesmgr</u>.claim.Claim</font></font><br>
<br>did you change the variable type, for example adding a new variable from a different type into the claim variable?<br><br>if not, can you post the stack trace about the class cast exception?<br>to know about from which class is trying to
cast...<br><br><br><br><br>
<div class="gmail_quote">2009/10/19 Bill Tarr <span dir="ltr"><<a href="mailto:javatestcase@yahoo.com" rel="nofollow" target="_blank">javatestcase@yahoo.com</a>></span><br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
<div>
<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></p></font>
<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 face="Tahoma" size="2">
<hr size="1">
<b><span style="font-weight: bold;">From:</span></b> Mauricio Salatino <<a href="mailto:salaboy@gmail.com" rel="nofollow" target="_blank">salaboy@gmail.com</a>><br><b><span style="font-weight: bold;">To:</span></b> Rules Users List <<a href="mailto:rules-users@lists.jboss.org" rel="nofollow" target="_blank">rules-users@lists.jboss.org</a>><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>
<div>
<div></div>
<div><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">javatestcase@yahoo.com</a>></span> wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); 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">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>- <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></div></div></div></div></div><br></div><br>_______________________________________________<br>
rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" rel="nofollow" target="_blank">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>
<br></blockquote></div><br><br clear="all"><br>-- <br>- <a href="http://salaboy.wordpress.com/" rel="nofollow" target="_blank">http://salaboy.wordpress.com</a><br>- <a href="http://www.jbug.com.ar/" rel="nofollow" target="_blank">http://www.jbug.com.ar</a><br>
- Salatino "Salaboy" Mauricio -<br></div></div></div></div></div><br>
</div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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></blockquote></div><br><br clear="all"><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>
</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>