[rules-users] NullPointerException when using RuleAgent

IPatel ishita.patel at usbank.com
Fri Feb 15 13:28:46 EST 2013


Hi, Thank you for your response...

So i have 2 methods readKnowledgeBase() and the main method. Both are
provided below. When i run the main method i get "Unable to parse ChangeSet"
error and java.io.FileNotFoundException the url specified in the
change-set.xml file. 

I am not able to understand how to fix changeSet error. i have place the
package url in the change-set.xml. do i need to save this file somewhere???
Please Help!!!


public static void main(String[] args) {
try {
 KnowledgeBase kbase =  readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
			
  Driver d = new Driver("Isha", 18, null, "lets try it" );
            ksession.insert(d);
            ksession.fireAllRules();
 } catch (Throwable t) {
            t.printStackTrace();
        }
	}


private static KnowledgeBase readKnowledgeBase() throws Exception {

ResourceChangeNotifier notifier =
ResourceFactory.getResourceChangeNotifierService();
ResourceChangeScanner scannerService =
ResourceFactory.getResourceChangeScannerService();
notifier.start();
scannerService.start();
KnowledgeAgentConfiguration kaconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaconf.setProperty("drools.agent.scanDirectories", "false");
KnowledgeAgent kagent =  KnowledgeAgentFactory.newKnowledgeAgent("MyAgent",
kaconf);
kagent.applyChangeSet(ResourceFactory.newUrlResource("http://localhost:8080/guvnor-5.5.0.Final-jboss-as-7.0/org.drools-guvnor/org.drools.guvnor.Guvnor/package/TestIsha/LATEST"));
	
	
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
return kbase;
     }



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


More information about the rules-users mailing list