[rules-users] running brl rules - error

Fnu Mahalakshmi FMahalakshmi at nyx.com
Fri Jun 11 16:17:03 EDT 2010


Hi,
I have {Rule1.drl,Rule2,drl,Rule3.brl}
Both the .drl rules run correctly but the .brl does not load and gives me the following error
Exception in thread "main" org.drools.rule.InvalidRulePackage: [1,0]: unknown:1:0 mismatched token: [@0,0:0='<',<79>,1:0];
      at org.drools.rule.Package.checkValidity(Package.java:424)
      at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)
      at com.org.RuleRunner.loadRules(RuleRunner.java:45)
      at com.org.RuleRunner.runStatelessRules(RuleRunner.java:79)
      at com.org.RulesTest.main(RulesTest.java:40)

I am loading my rules as follows:

    private RuleBase loadRules(String[]  rules) throws Exception{

          PackageBuilder builder = new PackageBuilder();

          for ( int i = 0; i < rules.length; i++ ) {
              String rulesFiles = rules[i];
              //Check the type of rule file, then load it
              System.out.println("loading rule file : "+rulesFiles);
              loadRuleFile(rulesFiles,builder);

          }
          Package pkg = builder.getPackage();
          RuleBase localRuleBase = RuleBaseFactory.newRuleBase();
          localRuleBase.addPackage( pkg );

          return localRuleBase;
    }

    private void loadRuleFile(String rulesFiles,PackageBuilder addRulesToThisPackage ) throws DroolsParserException, IOException{
        Reader source = new InputStreamReader( RuleRunner.class.getResourceAsStream(rulesFiles) );
        //Load the rules , no DSL
        addRulesToThisPackage.addPackageFromDrl(source); // is this wrong??? Is there another method that I should
                                                            be using???


    }
The above code is where I get the error.
Is there some other way to load .brl and .drl files?? We cannot do it together??
I could not find any help on;line on loading and running .brl files.

Please help.
Thank you.
M



</pre>

<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before printing this email.</font></STRONG></P>
<P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>

*****************************************************************************
<br>
Note:  The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure.  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system.  Thank you.  NYSE Euronext.

</STRONG></P><pre>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100611/fd0893d9/attachment.html 


More information about the rules-users mailing list