[rules-users] Help Needed on BRMS with Tomcat

SB.Raghavendra raghavendra.sb at gmail.com
Mon Mar 3 19:37:03 EST 2008


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080303/8037de28/attachment.html 


More information about the rules-users mailing list