Hi laune, you are right, the ksession is null. What would be the reason for this?
The code, " > KieContainer kc = > KieServices.Factory.get().getKieClasspathContainer(); > KieSession ksession = kc.newKieSession("CashFlowKS"); > " is the original code of example. Maybe I set something wrong in my project? My kmodule.xml is: <?xml version="1.0" encoding="UTF-8"?> <kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"> <kbase name="kBase"> <ksession name="CashFlowKS" /> </kbase> </kmodule> ----------------------------- The rule (CashFlow.drl) is package com.sample dialect "mvel" rule "Increase balance for AccountPeriod Credits" when ap : AccountPeriod( ) ac : Account( ) cf : CashFlow( type == CashFlowType.CREDIT, accountNo == ac.accountNo, date >= ap.start && <= ap.end ) then ac.balance = ac.balance + cf.amount; end rule "Decrease balance for AccountPeriod Debits" when ap : AccountPeriod( ) ac : Account( ) cf : CashFlow( type == CashFlowType.DEBIT, accountNo == ac.accountNo, date >= ap.start && <= ap.end ) then ac.balance = ac.balance - cf.amount; end rule "Print blance for AccountPeriod" salience -50 when ap : AccountPeriod( ) ac : Account( ) then System.out.println( "Account Number " + ac.accountNo + " balance " + ac.balance ); end -- View this message in context: http://drools.46999.n3.nabble.com/java-lang-NullPointerException-in-simple-example-tp4028177p4028193.html Sent from the Drools: User forum mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users