[rules-users] RES: Problem with proxy objects

Wolfgang Laun wolfgang.laun at gmail.com
Fri Feb 5 12:40:49 EST 2010


On Fri, Feb 5, 2010 at 5:46 PM, Rogerio Baldini
<rogerio.baldini at powerlogic.com.br> wrote:
> I think you didn't understand my problem.

Perhaps. But the code you posted doesn't seem right.

> I don't have any problem related to Java arrays.
> My problem is drools is not working with proxy objects.
>
> I am executing drools rules with one javassist object
> (package.MyClass_$$_javassist_2) and drools is not recognizing this object
> as package.MyClass and is not executing my rule.
>

In any case, your rules must reference the classes of the objects you
insert, or a superclasse, or an implemented interface. Otherwise, no
rule will fire.

-W


> Thanks,
>
> Rogério
>
>
>
>
> -----Mensagem original-----
> De: rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org] Em nome de Wolfgang Laun
> Enviada em: sexta-feira, 5 de fevereiro de 2010 14:13
> Para: Rules Users List
> Assunto: Re: [rules-users] Problem with proxy objects
>
> <quote from="Drools Expert Manual">
> Unfortunately a Java array does not implement the Iterable  interface, so we
> have to use the JDK converter method Arrays.asList(...).
> </quote>
>
> Try
>  ksession.execute( Arrays.asList( new Object[] { myObject} ) );
>
> -W
>
> 2010/2/5 Rogerio Baldini <rogerio.baldini at powerlogic.com.br>:
>> Hi guys,
>>
>>
>>
>> I am trying to execute rules passing a proxy object to it.
>>
>> The object myObject is a javassist proxy object:
>> package.MyClass_$$_javassist_2
>>
>>
>>
>> Properties p = new Properties();
>>
>> p.put("url",
>> "http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/
>> pacote/LATEST");
>>
>>
>>
>> RuleAgent agent = RuleAgent.newRuleAgent(p);
>>
>> RuleBase ruleBase = agent.getRuleBase();
>>
>>
>>
>> StatelessSession ksession = ruleBase.newStatelessSession();
>>
>>
>>
>> ksession.execute(new Object[] {myObject});
>>
>>
>>
>>
>>
>> So, with this proxy object, my rule is not executed. If I pass a real
>> instance, the rule works fine.
>>
>>
>>
>> package mypackage;
>>
>> import  package.MyClass;
>>
>>
>>
>> global java.util.List list
>>
>>
>>
>> rule "Testing"
>>
>>     dialect "java"
>>
>>                 when
>>
>>                     f: MyClass()
>>
>>                 then
>>
>>     System.out.println("Exist "+f.getDay());
>>
>>                     f.setDay("15");
>>
>> end
>>
>>
>>
>>
>>
>> Can anybody help me ?
>>
>> Thanks,
>>
>> Rogerio
>>
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list