[rules-users] Rules not firing when facts asserted in a rule RHS in 5.0 - diagnosed with workaround (but not fixed)

Chris Selwyn chris at selwyn-family.me.uk
Wed Dec 1 17:09:40 EST 2010


Having just looked in the Drools JIRA repository, I pretty sure that it 
is the same issue as was reported in JBRULES-2140 
<https://jira.jboss.org/browse/JBRULES-2140>.
That entry has a repro.

I am interested as to what you mean by "right around the corner"?

Here is a repro anyway...

<QUOTE>
package rulestest
global java.util.logging.Logger logger

declare QuestionValidation
     question: String
     mandatory: Boolean
     state: String
     type: String
end

function void testfunc() {
System.out.println("testfunc called");

}

rule 'init'
dialect "mvel"
when
     eval(true)
then
     QuestionValidation qv = new QuestionValidation();
     qv.setState("ss");
     qv.setQuestion("qq");
     insert(qv);
     logger.info("Hello world");

end

rule 'test'
dialect "mvel"
when
     $qv: QuestionValidation()
then
     logger.info("Found a qv " + $qv);

end
</QUOTE>

If the testfunc is present then the "test" rule never fires. If it is 
not present then the "test" rule fires just fine.

Chris

On 01/12/2010 21:47, Tihomir Surdilovic wrote:
> Hi Chris, could you attach the repository export xml from your repo 
> that I can use to reproduce the issue with? BRMS 5.1 (supported bits) 
> is right around the corner and I would be able to tell you if the 
> issue still persists with the currently tested bits for 5.1.
>
> Thanks.
> Tihomir
>
> On 12/1/10 4:29 PM, Chris Selwyn wrote:
>> Having spent all day on this one, I have finally got to the bottom of it.
>>
>> The problem is reproducible if I have /both/ a declarative fact model 
>> /and/ a function in my rules.
>> It doesn't matter whether the function is called or not... It's 
>> presence is enough to  cause the problem.
>>
>> Any rule that is dependent on the existence of an instance of the 
>> declarative fact model where the instance is created in the RHS of 
>> another rule will not fire.
>>
>> I suspect that this is a bug that has been fixed in 5.1 because I 
>> have been using this technique in Drools 5.1... It's only since 
>> downgrading to the (supported) JBoss Rules 5.0 that I have 
>> experienced the problem.
>>
>> Does anyone know if there is a fix in the 5.0 branch?
>>
>> If I create a "real" Java class and upload it in a jar file to the 
>> Guvnor and use that in place of the declarative model then the 
>> problem does not happen.
>> This is a workaround in the short term but I would much prefer not to 
>> have to do this.
>>
>> Chris Selwyn
>>
>>
>> On 01/12/2010 15:14, Chris Selwyn wrote:
>>> Yes the package is "SWWB2BOutgoing" but it looks as though the 
>>> package name simple doesn't get reported in the log file.
>>>
>>> I have been debugging through this thing and where I've got to so 
>>> far is that I am getting two (and maybe more) entries for the class 
>>> "SWWB2BOutgoing.QuestionValidation" in the 
>>> ObjectTypeConfigurationRepository.
>>> So my current question is "How is this possible?" Is it maybe a 
>>> classloader issue?
>>>
>>> Chris
>>>
>>>
>>> On 01/12/2010 12:05, Wolfgang Laun wrote:
>>>> A closer look:
>>>>
>>>> On 1 December 2010 11:13, Chris Selwyn <chris at selwyn-family.me.uk 
>>>> <mailto:chris at selwyn-family.me.uk>> wrote:
>>>>
>>>>
>>>>
>>>>     I can see the facts being inserted in the log as follows
>>>>     [#|2010-12-01T09:19:16.723+0000|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=70;_ThreadName=p:
>>>>     thread-pool-1; w: 7;|
>>>>     OBJECT ASSERTED value:QuestionValidation( mandatory=true,
>>>>     state=Closed,
>>>>     question=B2B_METER_SERIAL_NUMBER, type=string ) factId: 39|#]
>>>>
>>>>
>>>> Shouldn't the package name appear in the log as well?
>>>>
>>>>
>>>>     However, if I insert a QuestionValidation fact created in Java
>>>>     by using
>>>>     kbase.getFactType("SWWB2BOutgoing", "QuestionValidation") then
>>>>     the Test
>>>>     rule gets fired just fine.
>>>>
>>>>
>>>> That is, apparently "SWWB2BOutgoing".
>>>>
>>>> -W
>>>>
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>> No virus found in this message.
>>>> Checked by AVG - www.avg.com <http://www.avg.com>
>>>> Version: 10.0.1170 / Virus Database: 426/3290 - Release Date: 11/30/10
>>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>> No virus found in this message.
>>> Checked by AVG - www.avg.com <http://www.avg.com>
>>> Version: 10.0.1170 / Virus Database: 426/3290 - Release Date: 11/30/10
>>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 10.0.1170 / Virus Database: 426/3291 - Release Date: 12/01/10
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101201/aa27bef4/attachment.html 


More information about the rules-users mailing list