Version 2

    I'm afraid that is is actually not that the drool can't read/found the drl file, but it is because some .jar that needed by drools is not accessible. It is because when I purposely make a wrong syntax in drl file, drools still be able to detect it.


    The workaround is quite easy if the case is the same like mine. Just repeating what I said before, with a little more details.


    Server : JBoss AS 4.0.4GA with EJB3 RC8

    IDE : JDeveloper


    Say the server configuration that being used is "all" (there are also "minimal" and "default"), then go the directory




    That is, base on this case, if you're using other server like tomcat, maybe you should copy it into tomcat's lib folder. However this is just what I'm thinking though, not tried it yet.


    Instead of using getResourceAsStream() to get a drl's content, I just use a normal FileReader, and use an absolute path to access it (the drl file is in C: and Jboss is in D:). It brings a little convenience as we dont need to recompile the whole project if any changes being made in drl file. Also it is because my rule will soon be added into database so it don't really matter for now.


    Anyway my code is as follow :

            WorkingMemory workingMemory;
  "=====================Start rule ");       
            final PackageBuilder builder = new PackageBuilder();      
            if (ruleBase != null) {
      "rulebase not null : ");
                workingMemory = ruleBase.newWorkingMemory();
            } else {
                ruleBase = RuleReader. getRule(fileName);
                workingMemory = ruleBase.newWorkingMemory();
            try {
            } catch (Exception ex) {
      "An error asserting object!!");


    RuleReader's getRule(String fileName) code :


            PackageBuilder builder = new PackageBuilder();
  "READY TO READ : ");
            boolean exists = (new File(fileName)).exists();
            if (exists) {
      "FILE EXISTS");
            } else {
            Reader source = new FileReader(fileName);      
            try {
            } catch (IOException ioe) {
            } catch (DroolsParserException dpe) {
            } catch (Exception ex) {
            Package pkg = builder.getPackage();      
            ruleBase = RuleBaseFactory.newRuleBase();     
            return ruleBase;