<div>Drools version: 5.0.1<br>I defined two flows, one is main flow and the other is sub flow.<br>These two flows have same package name, and are built and added into one knowledge base.<br>When I start the main flow process, the NoSuchMethod error is thrown out.<br><br>I also test with two unrelated flows, and I can't get correct result. <br><br>So my question is that whether there is the constraint which two flows must not have same package name?<br><br><b>main.rf</b><br>&lt;?xml version="1.0" encoding="UTF-8"?&gt; <br>&lt;process xmlns="http://drools.org/drools-5.0/process"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="RuleFlow" name="flow" id="process_plan" package-name="sample" version="" &gt;<br><br>&nbsp; &lt;header&gt;<br>&nbsp;&nbsp;&nbsp; &lt;variables&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;variable name="v1" &gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;type name="org.drools.process.core.datatype.impl.type.BooleanDataType" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;value&gt;false&lt;/value&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/variable&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/variables&gt;<br>&nbsp; &lt;/header&gt;<br><br>&nbsp; &lt;nodes&gt;<br>&nbsp;&nbsp;&nbsp; &lt;start id="1" name="Start" x="195" y="15" width="30" height="30" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;split id="2" name="Split" x="185" y="70" width="40" height="40" type="2" &gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;constraints&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;constraint toNodeId="10" toType="DROOLS_DEFAULT" name="a" priority="1" type="code" dialect="java" &gt;return v1;&lt;/constraint&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;constraint toNodeId="11" toType="DROOLS_DEFAULT" name="b" priority="1" type="code" dialect="java" &gt;return !v1;&lt;/constraint&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/constraints&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/split&gt;<br>&nbsp;&nbsp;&nbsp; &lt;join id="5" name="Join" x="185" y="260" width="40" height="40" type="2" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;actionNode id="7" name="test" x="155" y="320" width="100" height="80" &gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action type="expression" dialect="java" &gt;System.out.println("Action Test");&lt;/action&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/actionNode&gt;<br>&nbsp;&nbsp;&nbsp; &lt;end id="8" name="End" x="191" y="436" width="28" height="28" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;subProcess id="9" name="SubProcess" x="312" y="292" width="96" height="76" processId="com.sample.subflow" independent="false" &gt;<br>&nbsp;&nbsp;&nbsp; &lt;/subProcess&gt;<br>&nbsp;&nbsp;&nbsp; &lt;actionNode id="10" name="a" x="75" y="151" width="80" height="40" &gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action type="expression" dialect="java" &gt;System.out.println("a");&lt;/action&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/actionNode&gt;<br>&nbsp;&nbsp;&nbsp; &lt;actionNode id="11" name="b" x="287" y="153" width="80" height="40" &gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action type="expression" dialect="java" &gt;System.out.println("b");&lt;/action&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/actionNode&gt;<br>&nbsp; &lt;/nodes&gt;<br><br>&nbsp; &lt;connections&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="1" to="2" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="10" to="5" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="11" to="5" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="9" to="7" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="7" to="8" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="5" to="9" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="2" to="10" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="2" to="11" /&gt;<br>&nbsp; &lt;/connections&gt;<br><br>&lt;/process&gt;<br><br><b>sub.rf</b><br>&lt;?xml version="1.0" encoding="UTF-8"?&gt; <br>&lt;process xmlns="http://drools.org/drools-5.0/process"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="RuleFlow" name="subflow" id="com.sample.subflow" package-name="sample" version="" &gt;<br><br>&nbsp; &lt;header&gt;<br>&nbsp; &lt;/header&gt;<br><br>&nbsp; &lt;nodes&gt;<br>&nbsp;&nbsp;&nbsp; &lt;start id="1" name="Start" x="29" y="76" width="30" height="30" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;actionNode id="2" name="Action" x="134" y="51" width="100" height="80" &gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action type="expression" dialect="java" &gt;System.out.println("This is test subflow");&lt;/action&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/actionNode&gt;<br>&nbsp;&nbsp;&nbsp; &lt;end id="3" name="End" x="309" y="77" width="28" height="28" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;actionNode id="4" name="Action" x="240" y="210" width="100" height="80" &gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action type="expression" dialect="java" &gt;System.out.println("This is test 2222");&lt;/action&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/actionNode&gt;<br>&nbsp; &lt;/nodes&gt;<br><br>&nbsp; &lt;connections&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="1" to="2" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="4" to="3" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;connection from="2" to="4" /&gt;<br>&nbsp; &lt;/connections&gt;<br><br>&lt;/process&gt;<br><br><b>Test codes:</b><br>public class XiaYuSubflowTest {<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; public static void main(String[] args) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; builder.add(ResourceFactory.newClassPathResource("main.rf"), ResourceType.DRF);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; builder.add(ResourceFactory.newClassPathResource("sub.rf"), ResourceType.DRF);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (builder.hasErrors()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println(builder.getErrors());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; kbase.addKnowledgePackages(builder.getKnowledgePackages());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; StatefulKnowledgeSession sks = kbase.newStatefulKnowledgeSession();&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sks.startProcess("process_plan");&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sks.dispose();&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br>}<br></div><br><br><span title="neteasefooter"/><hr/>
<a href="http://allyes.nie.163.com/main/adfclick?db=afanie&bid=1258,613,23&cid=147,4,1&sid=1355&show=ignore&url=http://tx2.163.com/fab.html">"雪见"杨幂邀你共品3D国韵网游《天下贰》,海报免费领</a>
</span>