[rules-users] Newbie need help.

mashup richard.bremner.nb at googlemail.com
Fri May 2 15:44:21 EDT 2008


Hi Alan,

Just thought I would say I suffered from the same problem and found the
solution hidden in the manual somewhere. The tutorial needs updated....

use:
WorkingMemory workingMemory = ruleBase.newStatefulSession();

and

workingMemory.insert(obj); //instead of assert

cheers

Richard


Alan Jeferson wrote:
> 
> Hi all!
> 
> After installing Eclipse 3.2.1, I downloaded drools Eclipse IDE 3.0.4
> plugin from  JBoss site and put it in the plugins folder of eclipse home
> dir. Then restart eclipse, then File -> New -> Project -> JBoss Rules ->
> New Rules Project. I give a name for the project and click Finish. This
> has create the project with two automatically  created source folders 
> namely src/java and src/rules. In src/java, I can see
> com.samples.DroolsTest.java which uses the rule Sample.drl in src/rules.
> 
> But I obtained some errors in code(the bold lines), like:
> 
> - the method newWorkingMemory() is undefined for ruleBase type
> - the method fireAllRules () is undefined for workingMemory type
> - the method addPackage(pkg) is undefined for ruleBase type
> 
> //load up the rulebase
>             RuleBase ruleBase = readRule();
>             WorkingMemory workingMemory = 
>                                              ruleBase.newWorkingMemory();
>             
>             //go !
>             Message message = new Message();
>             message.setMessage(  "Hello World" );
>             message.setStatus( Message.HELLO );
>             workingMemory.assertObject( message );
>             workingMemory.fireAllRules();   
>             .......................................................
>         //get the compiled package (which is serializable)
>         Package pkg = builder.getPackage();
>         
>         //add the package to a rulebase (deploy the rule package).
>         RuleBase ruleBase = RuleBaseFactory.newRuleBase();
>         ruleBase.addPackage( pkg );
>         
>     Please tell me what is the problem.
> 
>    Regards, Alan.
> 
>  
> ---------------------------------
> Sponsored Link
> 
> Degrees online in as fast as 1 Yr - MBA, Bachelor's, Master's, Associate -
> Click now to apply
> 

-- 
View this message in context: http://www.nabble.com/Newbie-need-help.-tp7261678p17026512.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list