You shouldn't use an absolute path to load your rules.
Instead, use this method (extracted from Drools examples and modified).


  | public static RuleBase readRule(Class readerClass, String rulesFile, String 
rulesDslFile) throws Exception 
  |     {                       
  |             if (rulesFile == null)
  |                     return null;                    
  |             PackageBuilder builder = new PackageBuilder();
  |             Reader source = new 
InputStreamReader(readerClass.getResourceAsStream(rulesFile));
  |             if (rulesDslFile == null)                       
  |                     builder.addPackageFromDrl(source);                      
  |             else
  |             {
  |                     Reader dsl = new 
InputStreamReader(readerClass.getResourceAsStream(rulesDslFile));
  |                     builder.addPackageFromDrl(source, dsl);                 
  |             }                                                               
  |             RuleBase ruleBase = RuleBaseFactory.newRuleBase();              
  |             Package pkg = builder.getPackage();
  |             ruleBase.addPackage(pkg);       
  |             return ruleBase;
  |     }
  | 

[...]
  | RuleBase ruleBase = readRule(MyClass.class, "rules.drl", null);
  | WorkingMemory wm = ruleBase.newWorkingMemory();
  | 

Hope it helps.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969256#3969256

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969256
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to