When I run my project – I have brl and drl rule files.

When I run it for the first time: I am converting brl to drl files.

I get this error


Exception in thread "main" java.lang.NullPointerException

      at java.io.Reader.<init>(Unknown Source)

      at java.io.InputStreamReader.<init>(Unknown Source)

      at com.org.RuleRunner.loadRuleFile(RuleRunner.java:87)

      at com.org.RuleRunner.loadRules(RuleRunner.java:44)

      at com.org.RuleRunner.runStatelessRules(RuleRunner.java:108)

      at com.org.RulesTest.main(RulesTest.java:40)



But after I run it for the first time and the rule.drl (converted file from brl to drl) exists in my directory – I run it again and then the program runs fine.


So number of .brl files that many number of exceptions(same as above) and then program runs.


Why is this happening?? Should it not create the file and load it into the rulebase?


My code for converting from brl to drl is :


                  BRXMLPersistence read = (BRXMLPersistence) BRXMLPersistence.getInstance();

                  BRDRLPersistence write = (BRDRLPersistence) BRDRLPersistence.getInstance();

                  brl = FileUtils.readFileToString(file);

                System.out.println("File content: " + brl);

                outputDRL = write.marshal(read.unmarshal(brl));

                String drlFilePath = "src/main/rules"+rulesFiles +".drl";

                System.out.println("drlFilePath "+drlFilePath +"rulesFiles "+rulesFiles);

                String path = rulesFiles+".drl";

                System.out.println("path "+path);

                System.out.println("drlfile "+drlFilePath);

                drlFile = new File(drlFilePath);

                FileUtils.writeStringToFile(drlFile, outputDRL);


                Reader source = new InputStreamReader( RuleRunner.class.getResourceAsStream(path) ); // error is here


            }catch (IOException e) {






Any idea why this problem?? Is there some error in my code above????


Please help.

Thank you


Please consider the environment before printing this email.

Visit our website at http://www.nyse.com
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.