I am getting the following error when trying to insert my object into ksession. I have attached my rules and java object. Please help me in debugging why this is happening. I am using java 5 and drools 5.0<br><br>thanks<br>
<br><b>error while inserting:</b><br><br>org.drools.RuntimeDroolsException: <br>defaultpkg.Rule_CheckStationNumber_0Eval0Invoker@e4aea391 : java.lang.NullPointerException<br><br><b>rules.drl</b><br>import java.lang.*;<br>
import java.util.*;<br>import ct.fw.rules.*;<br>import ct.fw.utils.*;<br>import ct.fw.rules.*;<br>import ct.fw.logging.*;<br>import ct.fw.pf.dbi.*;<br>import ct.fw.pf.dao.*;<br>import ct.fw.pf.seq.*;<br>import ct.fw.pf.util.*;<br>
import ct.fw.pf.vo.*;<br>import ct.fw.ex.*;<br>import org.apache.commons.lang.*;<br>import com.aa.gccp.domain.*;<br><br>   global ct.fw.rules.AssertionObject ao<br>   global ct.fw.logging.SmartLogger log<br>        <br>    function BillingRecord getRecord(AssertionObject ao) <br>
        {<br>            return (BillingRecord) ao.get(0);<br>        }<br>    function void debug(String msg,SmartLogger log)<br>        {<br>            log.debug(BusinessRulesValidator.class, msg);<br>        }<br>    function void error(String msg,SmartLogger log)<br>
        {<br>            log.error(BusinessRulesValidator.class, msg);<br>            System.out.println(&quot;Message from rules &quot;+msg);<br>        }<br>  <br>rule CheckTrue<br>when<br>   eval(true)<br>then<br>    System.out.println(&quot;evaluating true&quot;);<br>
end<br><br>rule CheckTrue2<br>when<br>   eval(true)<br>then<br>    error(&quot;evaluating from rules2&quot;,log);<br>end<br><br>rule CheckStationNumber<br>when<br>   eval(((getRecord(ao)).getStationNo()) == null)<br>then<br>
    error(&quot;station number should not be null&quot;,log);<br>end <br><br><b>part where i load the rules and insert the facts. There is no error when loading the rules.drl. That means no parsing errors. The error happens at ksessio.insert(assertionObject).</b><br>
<br>public void assertRulesObject(AssertionObject assertionObject) throws BusinessRuleException<br>    {<br>        long current = System.currentTimeMillis();<br>        KnowledgeBase kbase = knowledgeBasesMap.get(rulesFileName);<br>
<br>        if (kbase == null)<br>        {<br>            kbase = knowledgeBasesMap.get(rulesFileName + DRL);<br>        }<br><br>        if ((kbase == null) || ((current - lastRefreshedMilliseconds) &gt; refreshTimeMilliseconds))<br>
        {<br>            if (rulesFileName.toLowerCase().indexOf(DRL) == -1)<br>            {<br>                kbase = load(rulesFileName + DRL);<br>            }<br>            else<br>            {<br>                kbase = load(rulesFileName);<br>
            }<br><br>            lastRefreshedMilliseconds = System.currentTimeMillis();<br>        }<br>        this.assertionObject = assertionObject;<br><br>        List assertionobjectslist = new ArrayList();<br><b>// i am just doing this part just to make sure assertion object is not null and i will get some answer. this part runs fine.  </b>    <br>
  if (assertionObject != null)<br>        {<br>            assertionobjectslist = assertionObject.getValidationObjects();<br>            String StationNumber = ((BillingRecord) assertionObject.get(0)).getStationNo();<br>            System.out.println(&quot;Station Number in assertion object is &quot; + StationNumber);<br>
        }<br>        else<br>        {<br>            System.out.println(&quot;Assertion Object is null&quot;);<br>        }<br>        System.out.println(&quot;The number of objects in assertionobject is &quot; + assertionobjectslist.size());<br>
<br>        try<br>        {<br>            StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();<br><b>//the next line throws the exception</b><br>            ksession.insert(assertionObject);<br><br>            ksession.fireAllRules();<br>
            ksession.dispose();<br><br>        }<br>        catch (RuntimeDroolsException e1)<br>        {<br>            throw new BusinessRuleException(e1.getMessage());<br>        }<br><br>        businessRulesErrors = assertionObject.getBusinessRulesErrors();<br>
<br>        if (throwException)<br>        {<br>            if (!assertionObject.getBusinessRulesErrors().isEmpty())<br>            {<br>                throw new BusinessRuleException(businessRulesErrors);<br>            }<br>
        }<br>    }<br><br><br>Any help is appreciated. thanks<br><br>