Hi Guys,
I want to upgrade drools from 5.1.1 to 5.3.0 CR1, but i found
ResourceChangeScanner could't work.
In version 5.1.1, i wrote this code to get a KnowledgeAgent
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("ReleaseAgent");
kagent.addEventListener(new ReloadingRuleEventListener(this));
kagent.applyChangeSet(ResourceFactory.newClassPathResource("changeset-url.xml"));
changeset-url.xml content is like:
<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/...
<add
<resource
source='http://hostname:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/PackageName1/snapshot_release'
type='PKG' basicAuthentication="enabled"
username="user1"
password="123456" /
<resource
source='http://hostname:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/PackageName2/snapshot_release'
type='PKG' basicAuthentication="enabled"
username="user1"
password="123456" /
<resource
source='http://hostname:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/PackageName3/snapshot_release'
type='PKG' basicAuthentication="enabled"
username="user1"
password="123456" /
</add
</change-set
then wrote this code to scan if there is a new version snapshot on guvnor
ResourceChangeScannerConfiguration sconf = ResourceFactory
.getResourceChangeScannerService()
.newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval","60");
ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
It works very well, each time when ResourceChangeScanner finding there is
new snapshot, it can reload the rules from guvnor properly.
But when i updated to 5.3.0 CR1, ran this code, error happens:
Exception in thread "Thread-2" java.lang.IllegalStateException: reader does
have
a modified date
at
org.drools.io.impl.ReaderResource.getLastModified(ReaderResource.java
:64)
at
org.drools.io.impl.ResourceChangeScannerImpl.scan(ResourceChangeScann
erImpl.java:169)
at
org.drools.io.impl.ResourceChangeScannerImpl$ProcessChangeSet.run(Res
ourceChangeScannerImpl.java:326)
at java.lang.Thread.run(Thread.java:619)
It seems in new version, UrlResource was parsed to ReaderResource(i rememer
in 5.1.1, each resource in changeset-url.xml was parsed to UrlResource).
Can you give a help?
Thanks a lot
--
View this message in context:
http://drools.46999.n3.nabble.com/IllegalStateException-happens-when-Reso...
Sent from the Drools: User forum mailing list archive at
Nabble.com.