Hi All,

I defined Declarative model, Bank with fields( name, accntno, balance, deposit) in  com.simple package in Guvnor-5.2,
and also defined one Guided rule and one test scenario  and tested successfully in Guvnor.
But when I am trying to use same Declarative model(Bank) through API's in Eclipse,
I am getting following error,

java.lang.NullPointerException


Here is my Declarativemainclass:
In Eclipse, I defined BankDTableChangeSet.xml and Declarativemainclass.java defined in com/model package.

 
public class Declarativemainclass {
        public static void main(String args[])
{
        try
        {
                // get a reference to a knowledge base with a declared type:
                KnowledgeBase kbase =createKnowledgeBase();
               

                // get the declared FactType from Guvnor
FactType bankType =  (FactType) kbase.getFactType( "com.simple", "Bank" ); // Here I am getting above exception

                // handle the type as necessary:
                // create instances:
                Object bank = bankType.newInstance();

               
                // set attributes values
                bankType.set(bank, "name","Govinda");
                bankType.set(bank, "accntno", 498);

               
                // insert fact into a session
                StatefulKnowledgeSession ksession =kbase.newStatefulKnowledgeSession();
                ksession.insert(bank);
                ksession.fireAllRules();

               
                // read attributes
                int value1=(Integer) bankType.get(bank, "balance");
                int value2=(Integer) bankType.get(bank,"deposit");
               
                System.out.println(value1+"\t"+value2);
               
               
               
               
}
        catch(Exception e)
        {
                System.out.println(e);
        }
       
}
private static KnowledgeBase createKnowledgeBase()
{
       
       
        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("BankAgent");
Resource changeset = ResourceFactory.newClassPathResource("com/model/BankDTableChangeSet.xml");
kagent.applyChangeSet(changeset);
KnowledgeBase kbase = kagent.getKnowledgeBase();
   return kbase;
       
       
       
}


}




Please help me anyone...



Thanks and regards
Manohar Kokkula
Mailto: manohar.kokkula@tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you