[rules-users] knowledge agent unable to update rule/flow upon changes

James cyu021 at gmail.com
Thu Sep 8 00:02:41 EDT 2011


Hi all,

I follow the last reply in
"http://drools.46999.n3.nabble.com/KnowledgeAgent-not-reloading-KnowledgeBase-td121401.html"
and use the static method in following class to obtain knowledge base:
public class DroolsCore {
	private static KnowledgeAgent kagent = null;
	private static KnowledgeBase knowledgeBase = null;
	
	public static KnowledgeBase createKnowledgeBase() {
		if(kagent == null && knowledgeBase == null) {
			ResourceChangeScannerConfiguration sconf = 
				
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();      
			sconf.setProperty("drools.resource.scanner.interval", "10");
			
	    ResourceFactory.getResourceChangeScannerService().configure(sconf);
	    ResourceFactory.getResourceChangeScannerService().start();
	    ResourceFactory.getResourceChangeNotifierService().start();
	    
	    kagent = KnowledgeAgentFactory.newKnowledgeAgent("myagent");
	   
kagent.applyChangeSet(ResourceFactory.newClassPathResource("resource/changeSet.xml"));
			
			knowledgeBase = kagent.getKnowledgeBase();
		}
		return knowledgeBase;
	}
}

I have the my changeSet.xml as follows:
<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns='http://drools.org/drools-5.0/change-set'
						xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
						xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'>
	<add>
		<resource source='classpath:resource/rules/' type='DRL' />
		<resource source='classpath:resource/flows/' type='DRF' />
	</add>
</change-set>

After deploying the application as webapp, I can run the flow + rule all
right.
However, when I switch the execution order in my flow file on the fly and
run the app again (by cliking a link), I get the same result as the flow has
never been changed.
Moreover, I get the following error message when I uninstall the webapp from
my application server (WASCE/geronimo 2.1):
Exception in thread "Thread-44" java.lang.RuntimeException: This Resource
cannot
 be listed, or is not a directory
        at
org.drools.io.impl.ClassPathResource.listResources(ClassPathResource.
java:191)
        at
org.drools.io.impl.ResourceChangeScannerImpl.scan(ResourceChangeScann
erImpl.java:130)
        at
org.drools.io.impl.ResourceChangeScannerImpl$ProcessChangeSet.run(Res
ourceChangeScannerImpl.java:311)
        at java.lang.Thread.run(Thread.java:735)

Any help is appreciated.


--
View this message in context: http://drools.46999.n3.nabble.com/knowledge-agent-unable-to-update-rule-flow-upon-changes-tp3318638p3318638.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list