Hi Esteban

Unfortunately I haven't had time to work further on this issue, so I don't have an answer yet.

All I can say for now is it seems that the ReaderResources are being created along with the URLResource each time. This is evidenced by the details below.

In my test, I have the following changeset based on the mortgages sample (I have changed my hosting port):

----------------------------------------------------------------------------------------------

<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='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST' type='PKG' />
    </add>
</change-set>

----------------------------------------------------------------------------------------------

This changeset can be read as a UrlResource, ClassPathResource or ByteArrayResource. I then use the following code to initialise the KnowledgeAgent:

----------------------------------------------------------------------------------------------

SystemEventListenerFactory.setSystemEventListener(new PrintStreamSystemEventListener(System.out));
       
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("MortgageAgent");
Resource changeset = ResourceFactory.newClassPathResource("ChangeSet.xml");
kagent.applyChangeSet(changeset);

----------------------------------------------------------------------------------------------

Within the System event listener output, I see that the KnowledgeAgent picks up all of the KnowledgeDefinitions from Drools and creates them as new UrlResources. Next, it picks up the KnowledgeDefinitions from drools and creates these all as null ReaderResources. Here is some output from my System event listener:

----------------------------------------------------------------------------------------------

[2012-01-17 10:32:32,577:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
[2012-01-17 10:32:33,410:debug] KnowledgeAgent building resource map
[2012-01-17 10:32:33,411:debug] KnowledgeAgent no resource mapped for rule=[Rule name=Dummy rule, agendaGroup=MAIN, salience=0, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=Dummy rule, agendaGroup=MAIN, salience=0, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=Underage, agendaGroup=MAIN, salience=10, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=Bankruptcy history, agendaGroup=MAIN, salience=10, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=No bad credit checks, agendaGroup=MAIN, salience=10, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=no NINJAs, agendaGroup=MAIN, salience=10, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=Row 3 Pricing loans, agendaGroup=MAIN, salience=0, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=Row 1 Pricing loans, agendaGroup=MAIN, salience=0, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=Row 2 Pricing loans, agendaGroup=MAIN, salience=0, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=CreditApproval, agendaGroup=MAIN, salience=0, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=DateDslRule, agendaGroup=MAIN, salience=0, no-loop=false]
[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=CheckBoxDslRule, agendaGroup=MAIN, salience=0, no-loop=false]
[2012-01-17 10:32:33,412:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=RegexDslRule, agendaGroup=MAIN, salience=0, no-loop=false]
[2012-01-17 10:32:33,412:debug] KnowledgeAgent mapping resource=[ReaderResource resource=null encoding='null'] to KnowledgeDefinition=org.drools.rule.TypeDeclaration@b10723b8
[2012-01-17 10:32:33,412:debug] KnowledgeAgent notifier subscribing to resource=[ReaderResource resource=null encoding='null']
[2012-01-17 10:32:33,412:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@54b216b3 to resource=[ReaderResource resource=null encoding='null']
[2012-01-17 10:32:33,412:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@77f06d35 to resource=[ReaderResource resource=null encoding='null']
[2012-01-17 10:32:33,412:debug] KnowledgeAgent mapping resource=[ReaderResource resource=null encoding='null'] to KnowledgeDefinition=org.drools.rule.TypeDeclaration@a562a3f
[2012-01-17 10:32:33,412:debug] KnowledgeAgent mapping resource=[ReaderResource resource=null encoding='null'] to KnowledgeDefinition=org.drools.rule.TypeDeclaration@9baaa763
[2012-01-17 10:32:33,412:debug] KnowledgeAgent mapping resource=[ReaderResource resource=null encoding='null'] to KnowledgeDefinition=org.drools.rule.TypeDeclaration@fadf3f01
[2012-01-17 10:32:33,412:info] KnowledgeAgent new KnowledgeBase now built and in use
[2012-01-17 10:32:33,412:debug] KnowledgeAgent finished rebuilding KnowledgeBase using ChangeSet

----------------------------------------------------------------------------------------------

As a result of these ReaderResources existing, the ResourceChangeScanner cannot run as the ReaderResources do not have a modified date.

At the moment I am not sure why these ReaderResources are created but I would imagine they are there to represent the drools domain facts. There are four facts in the mortgages sample and four ReaderResources are created.

Regards

Dean





2012/1/17 Esteban Aliverti <esteban.aliverti@gmail.com>
Dean, did you figure out why your code is using a ReaderResource? There are other threads reporting this same problem.

Best Regards,

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
On Fri, Jan 6, 2012 at 2:14 PM, Jiri Svitak <jsvitak@redhat.com> wrote:
Hello Dean,

you are right,
https://issues.jboss.org/browse/GUVNOR-1699
solves something different. Bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=733008
still waits to be solved. I have updated this bugzilla to be linked to
belonging JIRA issues.
You can look also on other bugs which have the same root cause. But I am
not developer, so I cannot
tell you when it'll be fixed.

Jiri Svitak

On 01/05/2012 02:27 PM, Dean wrote:
> Hi
>
> I am experiencing a problem with starting the ResourceChangeScannerService
> as described here: https://bugzilla.redhat.com/show_bug.cgi?id=733008
>
> I can create a KnowledgeAgent instance and apply a changeset to it which
> loads the desired package from Guvnor. However, as soon as I attempt to
> start the ScannerService in order to be notified of changes to this package
> I immediately receive the exception: java.lang.IllegalStateException: reader
> does have a modified date. Then on every scanner interval following, the
> scanner fails each time with the same error message.
>
> Apparently, this issue has already been fixed here:
> https://issues.jboss.org/browse/GUVNOR-1699
>
> However, I am still experiencing this problem even with Drools 5.4.0.Beta1
>
> Could somebody perhaps help me with this. I am attempting to rebuild the
> source code on my side, however, I am having endless problems with Maven.
>
> Regards
>
> Dean
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Resource-Change-Scanner-Service-modified-date-error-tp3634802p3634802.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users