I believe there used to be an issue with action class generation (where
there could be a clash between actions of different processes), but this
was fixed quite some time ago. Could you verify whether the problem
still exists on the latest snapshot releases?
http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/tr...
Kris
Quoting "nesta.fdb" <nesta.fdb(a)163.com>:
Hi,
As my understanding, drools will generate java classes for action of
rule flow. It seems that if there are two rule flows, and they are in
one package, drools thinks that it's dirty to load generated java
class of second package, so drools will reload it.
Thanks very much.
Full stack trace:
Exception in thread "main" java.lang.NoSuchMethodError:
sample.Process_sample_0.action0(Lorg/drools/spi/KnowledgeHelper;Lorg/drools/spi/ProcessContext;)V
at
sample.Process_sample_0Action0Invoker.execute(Process_sample_0Action0Invoker.java:20)
at
org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:54)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:111)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:141)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:128)
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:111)
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:230)
at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1639)
at
org.drools.workflow.instance.node.SubProcessNodeInstance.internalTrigger(SubProcessNodeInstance.java:83)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:111)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:141)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:128)
at
org.drools.workflow.instance.node.JoinInstance.triggerCompleted(JoinInstance.java:152)
at
org.drools.workflow.instance.node.JoinInstance.internalTrigger(JoinInstance.java:52)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:111)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:141)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:128)
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:111)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:141)
at
org.drools.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:74)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:111)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:141)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:128)
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:111)
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:230)
at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1639)
at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1604)
at
org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:267)
at
drools.ruleflow.xiayu.XiaYuSubflowTest.main(XiaYuSubflowTest.java:32)
ÔÚ2009-11-23£¬"Kris Verlaenen" <Kris.Verlaenen(a)cs.kuleuven.be> дµÀ£º
>What do you mean by "NoSuchMethod error is thrown" ? Could you
provide
>the full stack trace? In theory, you should simply be able to call
any
>other process, whether it is in the same package or not.
>
>Kris
>
>Quoting "nesta.fdb" <nesta.fdb(a)163.com>:
>
>> Drools version: 5.0.1
>> I defined two flows, one is main flow and the other is sub flow.
>> These two flows have same package name, and are built and added
into
>> one knowledge base.
>> When I start the main flow process, the NoSuchMethod error is
thrown
>> out.
>>
>> I also test with two unrelated flows, and I can't get correct
result.
>>
>>
>> So my question is that whether there is the constraint which two
>> flows must not have same package name?
>>
>> main.rf
>> <?xml version="1.0" encoding="UTF-8"?>
>> <process
xmlns="http://drools.org/drools-5.0/process"
>>
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
>>
xs:schemaLocation="http://drools.org/drools-5.0/process
>> drools-processes-5.0.xsd"
>> type="RuleFlow" name="flow"
id="process_plan"
>> package-name="sample" version="" >
>>
>> <header>
>> <variables>
>> <variable name="v1" >
>> <type
>> name="org.drools.process.core.datatype.impl.type.BooleanDataType"
/>
>> <value>false</value>
>> </variable>
>> </variables>
>> </header>
>>
>> <nodes>
>> <start id="1" name="Start" x="195"
y="15" width="30"
height="30"
>> />
>> <split id="2" name="Split" x="185"
y="70" width="40"
height="40"
>> type="2" >
>> <constraints>
>> <constraint toNodeId="10" toType="DROOLS_DEFAULT"
name="a"
>> priority="1" type="code" dialect="java" >return
v1;</constraint>
>> <constraint toNodeId="11" toType="DROOLS_DEFAULT"
name="b"
>> priority="1" type="code" dialect="java" >return
!v1;</constraint>
>> </constraints>
>> </split>
>> <join id="5" name="Join" x="185"
y="260" width="40"
height="40"
>> type="2" />
>> <actionNode id="7" name="test" x="155"
y="320" width="100"
>> height="80" >
>> <action type="expression" dialect="java"
>> >System.out.println("Action Test");</action>
>> </actionNode>
>> <end id="8" name="End" x="191"
y="436" width="28" height="28"
/>
>> <subProcess id="9" name="SubProcess"
x="312" y="292"
width="96"
>> height="76" processId="com.sample.subflow"
independent="false" >
>> </subProcess>
>> <actionNode id="10" name="a" x="75"
y="151" width="80"
>> height="40" >
>> <action type="expression" dialect="java"
>> >System.out.println("a");</action>
>> </actionNode>
>> <actionNode id="11" name="b" x="287"
y="153" width="80"
>> height="40" >
>> <action type="expression" dialect="java"
>> >System.out.println("b");</action>
>> </actionNode>
>> </nodes>
>>
>> <connections>
>> <connection from="1" to="2" />
>> <connection from="10" to="5" />
>> <connection from="11" to="5" />
>> <connection from="9" to="7" />
>> <connection from="7" to="8" />
>> <connection from="5" to="9" />
>> <connection from="2" to="10" />
>> <connection from="2" to="11" />
>> </connections>
>>
>> </process>
>>
>> sub.rf
>> <?xml version="1.0" encoding="UTF-8"?>
>> <process
xmlns="http://drools.org/drools-5.0/process"
>>
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
>>
xs:schemaLocation="http://drools.org/drools-5.0/process
>> drools-processes-5.0.xsd"
>> type="RuleFlow" name="subflow"
id="com.sample.subflow"
>> package-name="sample" version="" >
>>
>> <header>
>> </header>
>>
>> <nodes>
>> <start id="1" name="Start" x="29"
y="76" width="30"
height="30"
>> />
>> <actionNode id="2" name="Action" x="134"
y="51" width="100"
>> height="80" >
>> <action type="expression" dialect="java"
>> >System.out.println("This is test subflow");</action>
>> </actionNode>
>> <end id="3" name="End" x="309"
y="77" width="28" height="28"
/>
>> <actionNode id="4" name="Action" x="240"
y="210" width="100"
>> height="80" >
>> <action type="expression" dialect="java"
>> >System.out.println("This is test 2222");</action>
>> </actionNode>
>> </nodes>
>>
>> <connections>
>> <connection from="1" to="2" />
>> <connection from="4" to="3" />
>> <connection from="2" to="4" />
>> </connections>
>>
>> </process>
>>
>> Test codes:
>> public class XiaYuSubflowTest {
>>
>> public static void main(String[] args) {
>> KnowledgeBuilder builder =
>> KnowledgeBuilderFactory.newKnowledgeBuilder();
>>
builder.add(ResourceFactory.newClassPathResource("main.rf"),
>> ResourceType.DRF);
>>
builder.add(ResourceFactory.newClassPathResource("sub.rf"),
>> ResourceType.DRF);
>> if (builder.hasErrors()) {
>> System.out.println(builder.getErrors());
>> }
>> KnowledgeBase kbase =
>> KnowledgeBaseFactory.newKnowledgeBase();
>>
kbase.addKnowledgePackages(builder.getKnowledgePackages());
>> StatefulKnowledgeSession sks =
>> kbase.newStatefulKnowledgeSession();
>> sks.startProcess("process_plan");
>> sks.dispose();
>> }
>> }
>>
>
>
>
>
>Disclaimer:
http://www.kuleuven.be/cwis/email_disclaimer.htm
Disclaimer:
http://www.kuleuven.be/cwis/email_disclaimer.htm