Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Drools 3.0.6 - Not able to execute more than one rule

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am new to drools. I am using Drools 3.0.6. When I execute just one rule, it works fine. But when I run the same file with 2 or more rules, at runtime in console the SOPs stops at
org.apache.commons.jci.compilers.JaninoJavaCompiler - compiling com.tcs.sgv.apps.requesthandler.services.Rule_Credit_Denied_0

Same example works fine in Eclipse and both rules are executed, but my constraints are jDeveloper, jdk1.4, OC4J. Can someone help me out

Following is my .java file code

PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new InputStreamReader(CreditExample.class.getResourceAsStream("/abc.drl")));
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
WorkingMemory workingMemory = ruleBase.newWorkingMemory();
Person child = new Person("Person 1", 15);
Person adult = new Person("Person 2", 25);
workingMemory.assertObject(adult);
workingMemory.assertObject(child);
workingMemory.fireAllRules();

Following is my .drl file

rule "Credit Allowed"
when
person:Person(age >= 18)
then
System.out.println("Credit allowed for " + person.getName());
end
rule "Credit Denied"
when
deniedPerson:Person(age < 18)
then
System.out.println("Credit denied for " + deniedPerson.getAge());
end

Thanks for any solution/replies
Regards
Vir
 
Vir Ra
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Can anyone please help me out with Drools 3.0.6

Thanks & Regards,
Vir
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic