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.
Mark
Ronald R. DiFrango wrote:
Please ignore this, I figured it out!
On 7/6/07, *Ronald R. DiFrango* <ron.difrango(a)gmail.com
<mailto:ron.difrango@gmail.com>> wrote:
Changed the loading order and now I get the following:
Exception in thread "main" java.lang.ExceptionInInitializerError
at
com.circuitcity.rtvcrms.test.MainBasedTester.testRules(MainBasedTester.java
:31)
at
com.circuitcity.rtvcrms.test.MainBasedTester.main(MainBasedTester.java:23)
Caused by: java.lang.RuntimeException: Failure loading the Rules
at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.<clinit>(
RtvDecisionEngine.java:47)
... 2 more
Caused by: org.drools.rule.InvalidRulePackage: [1,0]: unknown:1:0
required (...)+ loop (decision=2) did not match anything;
token=[@0,0:6='created',<8>,1:0]
at org.drools.rule.Package.checkValidity(Package.java:409)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:262)
at
com.circuitcity.rtvcrms.rules.RtvDecisionEngine.<clinit>(RtvDecisionEngine.java
:43)
... 2 more
On 7/6/07, *Ronald R. DiFrango* < ron.difrango(a)gmail.com
<mailto:ron.difrango@gmail.com>> wrote:
I am getting the following exception all of a sudden:
Exception in thread "main" java.lang.ExceptionInInitializerError
at
com.circuitcity.rtvcrms.test.MainBasedTester.testRules(MainBasedTester.java
:31)
at
com.circuitcity.rtvcrms.test.MainBasedTester.main(MainBasedTester.java:23)
Caused by: java.lang.RuntimeException: Failure loading the Rules
at
com.circuitcity.rtvcrms.rules.RtvDecisionEngine.<clinit>(
RtvDecisionEngine.java:47)
... 2 more
Caused by:
org.drools.compiler.PackageBuilder$MissingPackageNameException:
Missing package name for rule package.
at org.drools.compiler.PackageBuilder.validatePackageName
(PackageBuilder.java:278)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:214)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:147)
at com.circuitcity.rtvcrms.rules.RtvDecisionEngine
.<clinit>(RtvDecisionEngine.java:40)
... 2 more
Here are my DRL files:
created on: Dec 7, 2006
package com.circuitcity.rtvcrms.rules
#list any import classes here.
import java.math.BigDecimal ;
import java.math.BigInteger;
import com.circuitcity.rtvcrms.bw.Constants;
import com.circuitcity.rtvcrms.bw.DocumentTypes;
import com.circuitcity.rtvcrms.bw.StatusConstants;
import com.circuitcity.rtvcrms.Adjustment ;
import com.circuitcity.rtvcrms.DetailLine;
import com.circuitcity.rtvcrms.EffectivePrice;
import com.circuitcity.rtvcrms.RepaymentCode;
import com.circuitcity.rtvcrms.MatchingOutput;
#declare any global variables here
global java.util.List matchedList;
rule "CM Qty EQ RTV Qty"
salience 10
when
cmDetailLine : DetailLine(cmNumber != null, lineNumber
!= null, status != StatusConstants.MATCHED , cmRtvNumber :
cmRtvNumber, cmBrand : brand , cmModel : model, cmQuantity :
availableQuantity )
rtvDetailLine : DetailLine(rtvNumber != null,
rtvNumber == cmRtvNumber, lineNumber != null, status !=
StatusConstants.MATCHED , brand == cmBrand, model == cmModel,
availableQuantity == cmQuantity )
then
System.out.println(StatusConstants.MATCHED);
MatchingOutput output =
buildMatchingOutput(
rtvDetailLine.getBrand(),
rtvDetailLine.getClazz(),
cmDetailLine.getLineNumber(),
cmDetailLine.getCmNumber(),
(String)null, // defTag
rtvDetailLine.getEffectivePrice(),
(BigDecimal)null, // keyRecNo
rtvDetailLine.getItemCost(),
rtvDetailLine.getAvailableQuantity(),
rtvDetailLine.getModel (),
(String)null, // originalRepaymentCode
(BigDecimal)null, // rrLineNumber
rtvDetailLine.getLineNumber(),
rtvDetailLine.getRtvNumber(),
StatusConstants.MATCHED,
DocumentTypes.RTV_CM,
(String)null); // vendorNumber
matchedList.add(output);
cmDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY );
cmDetailLine.setStatus(StatusConstants.MATCHED);
rtvDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);
rtvDetailLine.setStatus(StatusConstants.MATCHED);
end
rule "RNR Qty EQ RTV Qty"
salience 10
when
rnrDetailLine : DetailLine(keyRecNo != null,
lineNumber != null, status != StatusConstants.MATCHED,
cmRtvNumber : cmRtvNumber, cmBrand : brand , cmModel : model,
cmQuantity : availableQuantity )
rtvDetailLine : DetailLine(rtvNumber != null,
rtvNumber == cmRtvNumber, lineNumber != null, status !=
StatusConstants.MATCHED, brand == cmBrand, model == cmModel,
availableQuantity == cmQuantity )
then
System.out.println(StatusConstants.MATCHED);
MatchingOutput output =
buildMatchingOutput(
rtvDetailLine.getBrand(),
rtvDetailLine.getClazz (),
(BigDecimal)null, // cmDetailLine.getLineNumber(),
(String)null, // cmDetailLine.getCmNumber(),
(String)null, // defTag
rtvDetailLine.getEffectivePrice (),
rnrDetailLine.getKeyRecNo(), // keyRecNo
rtvDetailLine.getItemCost(),
rtvDetailLine.getAvailableQuantity(),
rtvDetailLine.getModel(),
(String)null, // originalRepaymentCode
rnrDetailLine.getLineNumber(), // rrLineNumber
rtvDetailLine.getLineNumber(),
rtvDetailLine.getRtvNumber(),
StatusConstants.MATCHED,
DocumentTypes.RTV_RR,
(String)null); // vendorNumber
matchedList.add(output);
rnrDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);
rnrDetailLine.setStatus(StatusConstants.MATCHED);
rtvDetailLine.setAvailableQuantity(Constants.NO_MORE_QUANTITY);
rtvDetailLine.setStatus(StatusConstants.MATCHED);
end
#created on: Apr 10, 2007
package com.circuitcity.rtvcrms.rules
#list any import classes here.
import java.math.BigDecimal;
import com.circuitcity.rtvcrms.bw.ModelDiscrepancyOutput;
import com.circuitcity.rtvcrms.bw.StatusConstants ;
import com.circuitcity.rtvcrms.Adjustment;
import com.circuitcity.rtvcrms.DetailLine;
import com.circuitcity.rtvcrms.RepaymentCode;
import com.circuitcity.rtvcrms.MatchingOutput;
import org.drools.WorkingMemory ;
import org.drools.QueryResults;
import org.drools.QueryResult;
import java.util.Iterator;
#declare any global variables here
rule "Sum CM"
salience 90
when
mdOutput : ModelDiscrepancyOutput ()
repaymentCode : RepaymentCode( code == "MD")
cmAdjustment : Adjustment(cmNumber != null, lineNumber
!= null, originalRepaymentCode == "MD" )
then
System.out.println ("Sum CM");
mdOutput.setSumCmAndRnr(cmAdjustment.getAvailableQuantity());
end
Any thoughts?
------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users