package
com.test;import
java.io.FileInputStream;import
java.io.InputStreamReader;import
java.io.Reader;import
org.drools.RuleBase;import
org.drools.RuleBaseFactory;import
org.drools.StatefulSession;import
org.drools.compiler.PackageBuilder; public class Test1 { /** * @param args */ public static void main(String[] args) throws Exception{ // TODO Auto-generated method stubSystem.
out.println("Method Starts...");PackageBuilder builder =
new PackageBuilder();Reader source =
new InputStreamReader(new FileInputStream("testpackage.pkg"));System.
out.println("Got source.."); //PackageBuilder builder = new PackageBuilder(new Package("/testpackage.pkg"));builder.addPackageFromDrl(source);
//builder.addPackage(new PackageDescr("/testpackage.pkg"));System.
out.println("After adding package : "+builder.getPackage());RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
StatefulSession session = ruleBase.newStatefulSession();
//RuleAgent.Person adult =
new Person("Raghu",25); //Person child = new Person("John",12);session.insert(adult);
session.fireAllRules();
System.
out.println("Method Ends...");}
}
Exception in thread "main"
org.drools.compiler.PackageBuilder$MissingPackageNameException: Missing package name for rule package.at org.drools.compiler.PackageBuilder.validatePackageName(
PackageBuilder.java:320)at org.drools.compiler.PackageBuilder.addPackage(
PackageBuilder.java:236)at org.drools.compiler.PackageBuilder.addPackageFromDrl(
PackageBuilder.java:167)at com.test.Test1.main(
Test1.java:29)I kept downloaded pkg in the Rules project.
Iam trying to execute in Eclipse.Tomcat version 6.016.Could you please let me know how to resolve the isse....
Also Please let me know how to use the Binay package of BRMS..