Yes.. I will do it, this weekend probably. Greetings On Mon, Oct 19, 2009 at 6:09 PM, Kris Verlaenen < kris.verlae...@cs.kuleuven.be> wrote:
> This indeed seems to be am easy-to-fix bug, where the code is assuming > the node instance is a CompositeContextNodeInstance, while casting it to > a NodeInstanceContainer should have been sufficient (and that way the > ForEachNodeInstance would have been accepted as well). > > Mauricio, could you change the cast to NodeInstanceContainer and add a > test case to the junit tests for this as well? > > Thx, > Kris > > Quoting Bill Tarr <javatestc...@yahoo.com>: > > > ok, I uploaded a demo to: > > > > https://jira.jboss.org/jira/browse/JBRULES-2304 > > > > > > > > > > ________________________________ > > From: Mauricio Salatino <sala...@gmail.com> > > To: Rules Users List <rules-users@lists.jboss.org> > > Sent: Mon, October 19, 2009 2:42:41 PM > > Subject: Re: [rules-users] [droolsflow] JPAVariablePersister - > > ClassCastException on ForEachNodeInstance > > > > Can you upload with the jira issue an isolated test? > > > > > > > > On Mon, Oct 19, 2009 at 1:55 PM, Mauricio Salatino > > <sala...@gmail.com> wrote: > > > > Hmm I see.. that's another problem related with variable hierarchies > > inside the context. > > >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) > > > > > > > > > > > > > > >2009/10/19 Bill Tarr <javatestc...@yahoo.com> > > > > > >I think I have the variables covered, and no changes to the class > > hierarchies (and the flows work without persistenence still). > > >> > > >>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. > > >> > > >>The stack got buried in my overly long original post, here it is: > > >> > > >> > > >>java.lang.ClassCastException: > > org.drools.workflow.instance.node.ForEachNodeInstance cannot be cast > > to org.drools.workflow.instance.node.CompositeContextNodeInstance > > >> at > > > > org.drools.persistence.processinstance.ProcessInstanceInfo.restoreVariable(ProcessInstanceInfo.java:198) > > >> at > > > > org.drools.persistence.processinstance.ProcessInstanceInfo.restoreVariables(ProcessInstanceInfo.java:166) > > >> at > > > > org.drools.persistence.processinstance.ProcessInstanceInfo.getProcessInstance(ProcessInstanceInfo.java:144) > > >> at > > > > org.drools.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:62) > > >> at > > > > org.drools.common.AbstractWorkingMemory.getProcessInstance(AbstractWorkingMemory.java:1720) > > >> at > > > > org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:261) > > >> at > > > > org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:29) > > >> at > > > > org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:12) > > >> at > > > > org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:254) > > >> at > > > > org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getProcessInstance(CommandBasedStatefulKnowledgeSession.java:92) > > >> at > > > > com.csatp.svc.rulesmgr.claim.ClaimsDemoJpaTest.validateDocumentWorkflow2(ClaimsDemoJpaTest.java:182) > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > ________________________________ > > From: Mauricio Salatino <sala...@gmail.com> > > >>To: Rules Users List <rules-users@lists.jboss.org> > > >>Sent: Mon, October 19, 2009 1:40:37 PM > > >> > > >>Subject: Re: [rules-users] [droolsflow] JPAVariablePersister - > > ClassCastException on ForEachNodeInstance > > >> > > >> > > >>I'm trying to remember what's the problem.. > > >>But for what I remember it could be something like: > > >>you define the variable claim with type > > com.csatp.svc.rulesmgr.claim.Claim > > >> > > >>did you change the variable type, for example adding a new variable > > from a different type into the claim variable? > > >> > > >>if not, can you post the stack trace about the class cast > > exception? > > >>to know about from which class is trying to cast... > > >> > > >> > > >> > > >> > > >> > > >>2009/10/19 Bill Tarr <javatestc...@yahoo.com> > > >> > > >>Could you clarify what you mean by defining the variables? > > >>> > > >>>Are you referring to the header variable definitions? > > >>><variables> > > >>><variable name="claim" > > > >>><type > > name="org.drools.process.core.datatype.impl.type.ObjectDataType" > > className="com.csatp.svc.rulesmgr.claim.Claim" /> > > >>></variable> > > >>></variables> > > >>>If so, could you clarify what should be added? > > >>> > > >>> > > >>> > > >>> > > >>> > > ________________________________ > > From: Mauricio Salatino <sala...@gmail.com> > > >>>To: Rules Users List <rules-users@lists.jboss.org> > > >>>Sent: Mon, October 19, 2009 12:59:51 PM > > >>>Subject: Re: [rules-users] [droolsflow] JPAVariablePersister - > > ClassCastException on ForEachNodeInstance > > >>> > > >>> > > >>>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. > > >>>Can you try with that and get back with that? > > >>> > > >>> > > >>> > > >>>On Mon, Oct 19, 2009 at 12:52 PM, Bill Tarr > > <javatestc...@yahoo.com> wrote: > > >>> > > >>>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. > > >>>> > > >>>>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. > > >>>> > > >>>> StatefulKnowledgeSession session = > > JPAKnowledgeService.loadStatefulKnowledgeSession( 1, knowledgeBase, > > null, env ); > > >>>> ProcessInstance processClm = session.getProcessInstance(1); > > >>>> > > >>>>The second line (ClaimsDemoJpaTest.java:182) is the source of the > > stack trace below. The error makes sense, as: > > >>>> > > >>>> ForEachNodeInstance extends CompositeNodeInstance > > >>>> CompositeContextNodeInstance extends CompositeNodeInstance > > >>>> > > >>>>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. > > >>>> > > >>>> restoreVariable(variableInfo, parentIds, > > variableName, (CompositeContextNodeInstance) nodeInstance); > > >>>> > > >>>>Here is the stack: > > >>>> > > >>>>java.lang.ClassCastException: > > org.drools.workflow.instance.node.ForEachNodeInstance cannot be cast > > to org.drools.workflow.instance.node.CompositeContextNodeInstance > > >>>> at > > > > org.drools.persistence.processinstance.ProcessInstanceInfo.restoreVariable(ProcessInstanceInfo.java:198) > > >>>> at > > > > org.drools.persistence.processinstance.ProcessInstanceInfo.restoreVariables(ProcessInstanceInfo.java:166) > > >>>> at > > > > org.drools.persistence.processinstance.ProcessInstanceInfo.getProcessInstance(ProcessInstanceInfo.java:144) > > >>>> at > > > > org.drools.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:62) > > >>>> at > > > > org.drools.common.AbstractWorkingMemory.getProcessInstance(AbstractWorkingMemory.java:1720) > > >>>> at > > > > org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:261) > > >>>> at > > > > org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:29) > > >>>> at > > > > org.drools.command.runtime.process.GetProcessInstanceCommand.execute(GetProcessInstanceCommand.java:12) > > >>>> at > > > > org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:254) > > >>>> at > > > > org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getProcessInstance(CommandBasedStatefulKnowledgeSession.java:92) > > >>>> at > > > > com.csatp.svc.rulesmgr.claim.ClaimsDemoJpaTest.validateDocumentWorkflow2(ClaimsDemoJpaTest.java:182) > > >>>> > > >>>>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. > > >>>> > > >>>>I don't know if it helps, but here is the forEach node from the > > flow: > > >>>> > > >>>><forEach id="2" name="ForEach" x="423" y="62" width="200" > > height="150" variableName="role" collectionExpression="claim.roles" > > > >>>><nodes> > > >>>><subProcess id="1" name="Document Workflow" x="36" y="40" > > width="132" height="48" processId="DocumentWorkflow2" > > > >>>><mapping type="in" from="role" to="role" /> > > >>>></subProcess> > > >>>></nodes> > > >>>><connections> > > >>>></connections> > > >>>><in-ports> > > >>>><in-port type="DROOLS_DEFAULT" nodeId="1" > > nodeInType="DROOLS_DEFAULT" /> > > >>>></in-ports> > > >>>><out-ports> > > >>>><out-port type="DROOLS_DEFAULT" nodeId="1" > > nodeOutType="DROOLS_DEFAULT" /> > > >>>></out-ports> > > >>>></forEach> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>>_______________________________________________ > > >>>>rules-users mailing list > > >>>>rules-users@lists.jboss.org > > >>>>https://lists.jboss.org/mailman/listinfo/rules-users > > >>>> > > >>> > > >>> > > >>>-- > > >>>- http://salaboy.wordpress.com > > >>>- http://www.jbug.com.ar > > >>>- Salatino "Salaboy" Mauricio - > > >>> > > >>> > > >>>_______________________________________________ > > >>>rules-users mailing list > > >>>rules-users@lists.jboss.org > > >>>https://lists.jboss.org/mailman/listinfo/rules-users > > >>> > > >>> > > >> > > >> > > >>-- > > >>- http://salaboy.wordpress.com > > >>- http://www.jbug.com.ar > > >>- Salatino "Salaboy" Mauricio - > > >> > > >> > > >>_______________________________________________ > > >>rules-users mailing list > > >>rules-users@lists.jboss.org > > >>https://lists.jboss.org/mailman/listinfo/rules-users > > >> > > >> > > > > > > > > >-- > > >- http://salaboy.wordpress.com > > >- http://www.jbug.com.ar > > >- Salatino "Salaboy" Mauricio - > > > > > > > > > -- > > - http://salaboy.wordpress.com > > - http://www.jbug.com.ar > > - Salatino "Salaboy" Mauricio - > > > > > > > > > > > > > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm > _______________________________________________ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino "Salaboy" Mauricio -
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users