[rules-users] drools flow package issue

Nair, Mahesh Mahesh.Nair at qwest.com
Thu Feb 4 06:19:39 EST 2010



______________________________________________




Hi ,
I am facing this weird issue when I try running a Stateful session created from 2 different package files (one is the main flow and the other is the sub flow. I am using SNAPSHOT jars for the 5.1.0 version. (https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/)

The only difference being that I am loading the main process and the sub process from 2 different  package files (in my case a BLOB in the database).
The processes run individually; But when I tie them up (have a Re-usable sub process node in the main flow) together I get the below exception,

CONSOLE OUTPUT BELOW


SUBPROCESS Node 1
SUBPROCESS Node 2
SUBPROCESS Node 1
SUBPROCESS Node 2
java.lang.NoSuchMethodError: com.qwest.Process_com_qwest_0.action2(Lorg/drools/spi/KnowledgeHelper;Lorg/drools/spi/ProcessContext;)V
        at com.qwest.Process_com_qwest_0Action2Invoker.execute(Process_com_qwest_0Action2Invoker.java:20)
        at org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:54)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:135)
        at org.drools.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:37)
        at org.drools.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:101)
        at org.drools.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:82)
        at org.drools.workflow.instance.node.SubProcessNodeInstance.internalTrigger(SubProcessNodeInstance.java:122)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:135)
        at org.drools.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:62)
        at org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:58)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:135)
        at org.drools.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:62)
        at org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:58)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:135)
        at org.drools.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)
        at org.drools.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)
        at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
        at org.drools.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:16)
        at org.drools.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:185)
        at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:284)
        at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1763)
        at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1741)
        at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:284)




I create the KnowledgeSession usign the code below,


        conf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
        conf.setOption(EventProcessingOption.STREAM);
        builder = KnowledgeBuilderFactory.newKnowledgeBuilder();

                for (Iterator iterator = flowList.iterator(); iterator.hasNext();) {
                        RFFlowInfoT rfFlowInfo = (RFFlowInfoT) iterator.next();
                        pkgBytes = rfFlowInfo.getPkgFile();
                try {
                    ByteArrayInputStream bInputStream = new ByteArrayInputStream(pkgBytes);
                    if (bInputStream == null) {
                        System.out.println("Unable to create input stream from the pkg");
                    } else {
                        builder.add(ResourceFactory.newInputStreamResource(bInputStream), ResourceType.PKG);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                }

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(conf);
        kbase.addKnowledgePackages(builder.getKnowledgePackages());
        kSession = kbase.newStatefulKnowledgeSession();

        try {
                final ProcessInstance process = kSession.startProcess("mainFlow");
                int iResult = kSession.fireAllRules();
                System.out.println("rules fired! hopefully!!");
                } catch (Throwable e) {
                        e.printStackTrace();
                }


The flowList has contains 2 objects (main flow and the sub flow in the field pkgFile which is a byte array I get reading from a BLOB in the database). When I run, I notice that the sub process starts executing first and then the exception is thrown (as shown in the console output above)


I have attached the rf files in this mail.

Please let me where I am going wrong?

One more thing to note is that this issue does not arise if I create one single Package object (containing both main flow and sub flow rf xml files).
It works fine when I create the KnowledgeSession from the same code above (just that the flowList now contains only one object of Package class which has both the main flow and sub flow combined)

Is this a bug or is there something I am doing wrong.

Regards,
Mahesh



  ________________________________
This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100204/d9f71572/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MainFlow.rf
Type: application/octet-stream
Size: 1465 bytes
Desc: MainFlow.rf
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100204/d9f71572/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subProcessFlow.rf
Type: application/octet-stream
Size: 1091 bytes
Desc: subProcessFlow.rf
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100204/d9f71572/attachment-0001.obj 


More information about the rules-users mailing list