[rules-users] Resource Change Scanner Service modified date error

Esteban Aliverti esteban.aliverti at gmail.com
Fri Jan 6 04:13:33 EST 2012


Could you please share with us how are you adding your resources to the
agent? According to what you are saying I assume you are using a
ReaderResource. According to Drools code, ReaderResource doesn't support
most of org.drools.io.internal.InternalResource methods. Some of these
methods (i.e. getLastModified()) are used by ResourceScanner to check if a
resource has actually changed.
So if we take a look at ReaderResource.getLastModified() we will see this:

public long getLastModified() {
    throw new IllegalStateException( "reader does have a modified date" );
}

You can find the whole source code here:
https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/io/impl/ReaderResource.java

So, don't expect this to work :)

There are 2 things you can do:

   1. Submit a patch for ReaderResource.java implementing all the
   unimplemented methods :)
   2. Use a different Resource like UrlResource, FileResource,
   InputStreamResource, etc.

In my opinion, Bug 733008 must be reopened until someone (maybe you Dean)
provides a correct implementation of ReaderResource.

Best Regards,

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Fri, Jan 6, 2012 at 8:53 AM, Dean <dean at qualica.com> wrote:

> I'm pretty sure this issue is the same as Bug 733008
> (https://bugzilla.redhat.com/show_bug.cgi?id=733008).
>
> I have updated the class from Bug 733008 to reproduce the bug in Drools
> 5.4.0.Beta1:
>
> http://drools.46999.n3.nabble.com/file/n3637279/AgentTest.java
> AgentTest.java
>
> It doesn't seem to be possible to scan a resource for changes at all. Even
> if I execute ResourceFactory.getResourceChangeScannerService().scan();
> directly, I get the same error message:
>
> [2012-01-06 09:47:57,144:exception]
> 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(ResourceChangeScannerImpl.java:166)
>        at
>
> org.drools.io.impl.ResourceChangeScannerImpl$ProcessChangeSet.run(ResourceChangeScannerImpl.java:311)
>        at java.lang.Thread.run(Thread.java:662)
>
> (As a side note the error message should probably read: reader does /not/
> have a modified date)
>
> Regards
>
> Dean
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Resource-Change-Scanner-Service-modified-date-error-tp3634802p3637279.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120106/809ad247/attachment.html 


More information about the rules-users mailing list