<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><?xml version="1.0" encoding="UTF-8"?> <br><process xmlns="http://drools.org/drools-5.0/process"<br> xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"<br> xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"<br> type="RuleFlow" name="flow" id="process_plan" package-name="sample" version="" ><br><br> <header><br> <variables><br> <variable name="v1" ><br> <type name="org.drools.process.core.datatype.impl.type.BooleanDataType" /><br> <value>false</value><br> </variable><br> </variables><br> </header><br><br> <nodes><br> <start id="1" name="Start" x="195" y="15" width="30" height="30" /><br> <split id="2" name="Split" x="185" y="70" width="40" height="40" type="2" ><br> <constraints><br> <constraint toNodeId="10" toType="DROOLS_DEFAULT" name="a" priority="1" type="code" dialect="java" >return v1;</constraint><br> <constraint toNodeId="11" toType="DROOLS_DEFAULT" name="b" priority="1" type="code" dialect="java" >return !v1;</constraint><br> </constraints><br> </split><br> <join id="5" name="Join" x="185" y="260" width="40" height="40" type="2" /><br> <actionNode id="7" name="test" x="155" y="320" width="100" height="80" ><br> <action type="expression" dialect="java" >System.out.println("Action Test");</action><br> </actionNode><br> <end id="8" name="End" x="191" y="436" width="28" height="28" /><br> <subProcess id="9" name="SubProcess" x="312" y="292" width="96" height="76" processId="com.sample.subflow" independent="false" ><br> </subProcess><br> <actionNode id="10" name="a" x="75" y="151" width="80" height="40" ><br> <action type="expression" dialect="java" >System.out.println("a");</action><br> </actionNode><br> <actionNode id="11" name="b" x="287" y="153" width="80" height="40" ><br> <action type="expression" dialect="java" >System.out.println("b");</action><br> </actionNode><br> </nodes><br><br> <connections><br> <connection from="1" to="2" /><br> <connection from="10" to="5" /><br> <connection from="11" to="5" /><br> <connection from="9" to="7" /><br> <connection from="7" to="8" /><br> <connection from="5" to="9" /><br> <connection from="2" to="10" /><br> <connection from="2" to="11" /><br> </connections><br><br></process><br><br><b>sub.rf</b><br><?xml version="1.0" encoding="UTF-8"?> <br><process xmlns="http://drools.org/drools-5.0/process"<br> xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"<br> xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"<br> type="RuleFlow" name="subflow" id="com.sample.subflow" package-name="sample" version="" ><br><br> <header><br> </header><br><br> <nodes><br> <start id="1" name="Start" x="29" y="76" width="30" height="30" /><br> <actionNode id="2" name="Action" x="134" y="51" width="100" height="80" ><br> <action type="expression" dialect="java" >System.out.println("This is test subflow");</action><br> </actionNode><br> <end id="3" name="End" x="309" y="77" width="28" height="28" /><br> <actionNode id="4" name="Action" x="240" y="210" width="100" height="80" ><br> <action type="expression" dialect="java" >System.out.println("This is test 2222");</action><br> </actionNode><br> </nodes><br><br> <connections><br> <connection from="1" to="2" /><br> <connection from="4" to="3" /><br> <connection from="2" to="4" /><br> </connections><br><br></process><br><br><b>Test codes:</b><br>public class XiaYuSubflowTest {<br> <br> public static void main(String[] args) {<br> KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();<br> builder.add(ResourceFactory.newClassPathResource("main.rf"), ResourceType.DRF);<br> builder.add(ResourceFactory.newClassPathResource("sub.rf"), ResourceType.DRF);<br> if (builder.hasErrors()) {<br> System.out.println(builder.getErrors());<br> }<br> KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();<br> kbase.addKnowledgePackages(builder.getKnowledgePackages());<br> StatefulKnowledgeSession sks = kbase.newStatefulKnowledgeSession(); <br> sks.startProcess("process_plan"); <br> sks.dispose(); <br> }<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>