[rules-users] Re: Testing out Type Declarations in simple rule file causing exceptions

Edson Tirelli tirelli at post.com
Sun Mar 15 09:10:52 EDT 2009


   There were some changes in the latest MVEL release making it more strict
on type resolution. We caught most of the scenarios and changed the code
accordingly, but we probably missed this one.

   Could you please open a JIRA with this description of the problem? I will
fix it asap.

   Thanks,

   []s
   Edson

2009/3/15 CK <chrisckc at gmail.com>

> So I did further testing and I was able to narrow it down.
>
> Somehow the culprit is with the import statements.  My DRL file has a
> package name of:
>
> package com.test.abc
> dialect "mvel"
>
> So, it appears that in drools using MVEL, a fully qualified name is
> required to instantiate the class?  It's quite strange though.  Considering
> that I'm following the docs, I should be able to dynamically create a new
> type declaration instance without qualifying it.
>
> The following somehow works:
>
> then
>  insert(new com.test.abc.Domestic());
> end
>
> Why is drools/mvel being so strict?
>
> -ck
>
>
> On Mar 15, 2009, at 4:23 AM, CK wrote:
>
>  Hi,
>>
>> I'm wondering if I am doing something wrong in my code:
>>
>> I create dummy type declarations to indicate presence of certain states
>> (is there possibly a better way of doing this?):
>>
>> declare Domestic
>>  dummy : boolean
>> end
>>
>> declare Multiple
>>  dummy : boolean
>> end
>>
>> rule "..."
>>  when
>>        ......
>>   then
>>        insert(new Domestic());
>> end
>>
>>
>> Something like this is giving me the following errors during DRL file
>> parsing:
>>
>> Unable to build expression for 'consequence': Failed to compile: 1
>> compilation error(s):
>> - (0,0) could not resolve class: Domestic '    insert(new Domestic());
>>
>>
>> Based on what the docs say, this should generate the proper dynamic
>> classes and I should immediately be able to use the declared types.
>>
>> I did additional checking by outputting the registered Type Declarations.
>>  These two types are indeed registered in the
>> PackageBuilder.getPackage().getTypeDeclarations().
>>
>> So I can only guess that either I'm doing something wrong here or there is
>> a bug in the CR1 release.
>>
>>
>>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090315/48dfe5bc/attachment.html 


More information about the rules-users mailing list