Hi All,
Iam very new to Drools BRMS.In one of the project we are implementing
drools.Currentluy iam working on BRMS.I have downloaded Insurance
Example from Jboss and deployed in BRMS.I have downloaded Binary
package to "c:\Raghu".Now i want to use this downloaded binary package
in one of my rule project and wants to execute.I written following
lines of code in the main executable class :
*
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 stub
System.
/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...");
}
}
But iam getting follwing error on console :
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..
--
Regards,
SB.Raghavendra.
------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users