<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Check the results on the PackageBuilder before getting the package and
adding it to the RuleBase. PackageBuilder provides the list of
problems, rather than the toString() that RuleBase does.<br>
<br>
Mark<br>
Ronald R. DiFrango wrote:
<blockquote
 cite="mid:eb33f140707061352q1dbac076udb4f68719d0495a1@mail.gmail.com"
 type="cite">Please ignore this, I figured it out!<br>
  <br>
  <div><span class="gmail_quote">On 7/6/07, <b class="gmail_sendername">Ronald
R. DiFrango</b> &lt;<a moz-do-not-send="true"
 href="mailto:ron.difrango@gmail.com">ron.difrango@gmail.com</a>&gt;
wrote:</span>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Changed
the loading order and now I get the following:<span class="q"><br>
    <br>
Exception in thread "main" java.lang.ExceptionInInitializerError<br>
&nbsp;&nbsp;&nbsp; at
com.circuitcity.rtvcrms.test.MainBasedTester.testRules(MainBasedTester.java
:31)<br>
&nbsp;&nbsp;&nbsp; at
com.circuitcity.rtvcrms.test.MainBasedTester.main(MainBasedTester.java:23)<br>
Caused by: java.lang.RuntimeException: Failure loading the Rules<br>
&nbsp;&nbsp;&nbsp; at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.&lt;clinit&gt;(
RtvDecisionEngine.java:47)<br>
&nbsp;&nbsp;&nbsp; ... 2 more<br>
    </span>Caused by: org.drools.rule.InvalidRulePackage: [1,0]:
<a class="moz-txt-link-freetext" href="unknown:1:0">unknown:1:0</a> required (...)+ loop (decision=2) did not match anything;
token=[@0,0:6='created',&lt;8&gt;,1:0]
    <br>
&nbsp;&nbsp;&nbsp; at org.drools.rule.Package.checkValidity(Package.java:409)<br>
&nbsp;&nbsp;&nbsp; at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:262)<br>
&nbsp;&nbsp;&nbsp; at
com.circuitcity.rtvcrms.rules.RtvDecisionEngine.&lt;clinit&gt;(RtvDecisionEngine.java
:43)<br>
&nbsp;&nbsp;&nbsp; ... 2 more
    <div><span class="e" id="q_1139d4a8da0849a1_3"><br>
    <br>
    <div><span class="gmail_quote">On 7/6/07, <b
 class="gmail_sendername">Ronald R. DiFrango</b> &lt;<a
 moz-do-not-send="true" href="mailto:ron.difrango@gmail.com"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
ron.difrango@gmail.com</a>&gt; wrote:</span>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I
am getting the following exception all of a sudden:<br>
      <br>
Exception in thread "main" java.lang.ExceptionInInitializerError<br>
&nbsp;&nbsp;&nbsp; at
com.circuitcity.rtvcrms.test.MainBasedTester.testRules(MainBasedTester.java
:31)
      <br>
&nbsp;&nbsp;&nbsp; at
com.circuitcity.rtvcrms.test.MainBasedTester.main(MainBasedTester.java:23)<br>
Caused by: java.lang.RuntimeException: Failure loading the Rules<br>
&nbsp;&nbsp;&nbsp; at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.&lt;clinit&gt;(
RtvDecisionEngine.java:47)<br>
&nbsp;&nbsp;&nbsp; ... 2 more<br>
Caused by:
org.drools.compiler.PackageBuilder$MissingPackageNameException: Missing
package name for rule package.<br>
&nbsp;&nbsp;&nbsp; at org.drools.compiler.PackageBuilder.validatePackageName
(PackageBuilder.java:278)<br>
&nbsp;&nbsp;&nbsp; at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:214)<br>
&nbsp;&nbsp;&nbsp; at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:147)<br>
&nbsp;&nbsp;&nbsp; at com.circuitcity.rtvcrms.rules.RtvDecisionEngine
.&lt;clinit&gt;(RtvDecisionEngine.java:40)<br>
&nbsp;&nbsp;&nbsp; ... 2 more<br>
      <br>
      <br>
Here are my DRL files:<br>
      <br>
created on: Dec 7, 2006<br>
package com.circuitcity.rtvcrms.rules<br>
      <br>
#list any import classes here.<br>
import java.math.BigDecimal
;<br>
import java.math.BigInteger;<br>
import com.circuitcity.rtvcrms.bw.Constants;<br>
import com.circuitcity.rtvcrms.bw.DocumentTypes;<br>
import com.circuitcity.rtvcrms.bw.StatusConstants;<br>
      <br>
import com.circuitcity.rtvcrms.Adjustment
;<br>
import com.circuitcity.rtvcrms.DetailLine;<br>
import com.circuitcity.rtvcrms.EffectivePrice;<br>
import com.circuitcity.rtvcrms.RepaymentCode;<br>
import com.circuitcity.rtvcrms.MatchingOutput;<br>
      <br>
#declare any global variables here
      <br>
global java.util.List matchedList;<br>
      <br>
rule "CM Qty EQ RTV Qty"<br>
&nbsp;&nbsp;&nbsp; salience 10<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cmDetailLine : DetailLine(cmNumber != null, lineNumber !=
null,&nbsp; status != StatusConstants.MATCHED
, cmRtvNumber : cmRtvNumber, cmBrand : brand , cmModel : model,
cmQuantity : availableQuantity&nbsp; )<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber ==
cmRtvNumber, lineNumber != null, status != StatusConstants.MATCHED
, brand == cmBrand, model == cmModel, availableQuantity == cmQuantity )
      <br>
&nbsp;&nbsp;&nbsp; then <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println(StatusConstants.MATCHED);<br>
      <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MatchingOutput output =<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; buildMatchingOutput(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getBrand(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getClazz(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cmDetailLine.getLineNumber(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cmDetailLine.getCmNumber(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (String)null, // defTag<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getEffectivePrice(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (BigDecimal)null, // keyRecNo<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getItemCost(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getAvailableQuantity(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getModel
(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (String)null, // originalRepaymentCode<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (BigDecimal)null, // rrLineNumber<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getLineNumber(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getRtvNumber(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; StatusConstants.MATCHED,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DocumentTypes.RTV_CM,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (String)null); // vendorNumber<br>
      <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; matchedList.add(output);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cmDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY
);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cmDetailLine.setStatus(StatusConstants.MATCHED);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.setStatus(StatusConstants.MATCHED);<br>
end<br>
      <br>
rule "RNR Qty EQ RTV Qty"
      <br>
&nbsp;&nbsp;&nbsp; salience 10<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rnrDetailLine : DetailLine(keyRecNo != null, lineNumber !=
null, status != StatusConstants.MATCHED, cmRtvNumber : cmRtvNumber,
cmBrand : brand , cmModel : model, cmQuantity : availableQuantity&nbsp;&nbsp; )
      <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber ==
cmRtvNumber, lineNumber != null, status != StatusConstants.MATCHED,
brand == cmBrand, model == cmModel, availableQuantity == cmQuantity )<br>
&nbsp;&nbsp;&nbsp; then <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println(StatusConstants.MATCHED);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MatchingOutput output =<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; buildMatchingOutput(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getBrand(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getClazz
(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (BigDecimal)null, // cmDetailLine.getLineNumber(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (String)null, // cmDetailLine.getCmNumber(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (String)null, // defTag<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getEffectivePrice
(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rnrDetailLine.getKeyRecNo(), // keyRecNo<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getItemCost(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getAvailableQuantity(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getModel(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (String)null, // originalRepaymentCode
      <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rnrDetailLine.getLineNumber(), // rrLineNumber<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getLineNumber(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.getRtvNumber(),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; StatusConstants.MATCHED,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DocumentTypes.RTV_RR,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (String)null); // vendorNumber<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; matchedList.add(output);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rnrDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rnrDetailLine.setStatus(StatusConstants.MATCHED);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvDetailLine.setStatus(StatusConstants.MATCHED);<br>
end<br>
      <br>
#created on: Apr 10, 2007
      <br>
package com.circuitcity.rtvcrms.rules<br>
      <br>
#list any import classes here.<br>
import java.math.BigDecimal;<br>
      <br>
import com.circuitcity.rtvcrms.bw.ModelDiscrepancyOutput;<br>
import com.circuitcity.rtvcrms.bw.StatusConstants
;<br>
import com.circuitcity.rtvcrms.Adjustment;<br>
import com.circuitcity.rtvcrms.DetailLine;<br>
import com.circuitcity.rtvcrms.RepaymentCode;<br>
import com.circuitcity.rtvcrms.MatchingOutput;<br>
import org.drools.WorkingMemory
;<br>
import org.drools.QueryResults;<br>
import org.drools.QueryResult;<br>
import java.util.Iterator;<br>
      <br>
#declare any global variables here<br>
      <br>
rule "Sum CM"<br>
&nbsp;&nbsp;&nbsp; salience 90<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mdOutput : ModelDiscrepancyOutput ()
      <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; repaymentCode : RepaymentCode( code == "MD")<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cmAdjustment : Adjustment(cmNumber != null, lineNumber != null,
originalRepaymentCode == "MD" )<br>
&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println
("Sum CM"); <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mdOutput.setSumCmAndRnr(cmAdjustment.getAvailableQuantity());<br>
end<br>
      <br>
Any thoughts?<br>
    </blockquote>
    </div>
    <br>
    </span></div>
  </blockquote>
  </div>
  <br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
</blockquote>
<br>
</body>
</html>