[rules-users] NullPointerException when using RuleAgent

IPatel ishita.patel at usbank.com
Thu Feb 14 15:41:44 EST 2013


Hi,

I have been trying to write the following code to automatically deploy any
changes made to the rules. However i am getting nullpointerexception errors.
I see many posts regarding this topic and have tried different options but
the error won;t go away.

public static void main(String[] args) {
		try {
 FileInputStream file = new
FileInputStream("C:\\Users\\folderabc\\workspace\\Drools
Sample\\bin\\Guvnor.properties");
           Properties p = new Properties();
           p.load(file);
            RuleAgent agent = RuleAgent.newRuleAgent(p); *<-- this is where
it is failing*            RuleBase rb = agent.getRuleBase();
            WorkingMemory ksession = rb.newStatefulSession();
            Car c = new Car("yellow", 2100);
            Driver d = new Driver("Isha", 18, c, "lets try it" );
            ksession.insert(d);
            ksession.fireAllRules();
            //logger.close();
        } catch (Throwable t) {
            t.printStackTrace();
        }
	}

/Here are the errors i am getting on my console:/
java.lang.NullPointerException
	at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:384)
	at org.drools.agent.RuleAgent.configure(RuleAgent.java:368)
	at org.drools.agent.RuleAgent.init(RuleAgent.java:268)
	at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:208)
	at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:168)
	at kijanowski.GuvnorTest.main(GuvnorTest.java:43)

Any help will be greatly appreciated. Thank you



--
View this message in context: http://drools.46999.n3.nabble.com/NullPointerException-when-using-RuleAgent-tp4022333.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list