Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-06-22 Thread Davide Sottara
I tried to repdroduce the issue, but I couldn't get the same error.. could
you provide a test case?
Also notice that I made some fixes in a pull request which has been out
there for a while, waiting
to get approved.. it may be the case that the fix is already contained in
there
Davide

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p4018198.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


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-06-22 Thread Davide Sottara
The DRL you reported is working for me with both stateful and stateless.. it
may indeed be the case that I have already fixed the issue as a part of
another fix :) The PR should be confirmed in a few days

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p4018199.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


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-05-17 Thread Davide Sottara
Thanks for reporting this, I'll double check and fix it as soon as possible
Best
Davide

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p3999543.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


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-03-31 Thread Michal Bali
Thanks Davide,
I have verified that this is working now with the latest SNAPSHOT.

Best regards,
Michal

On Fri, Mar 30, 2012 at 3:03 AM, Davide Sottara dso...@gmail.com wrote:

 The fix should have been applied today, you can find it in HEAD or in the
 upcoming 5.4CR1 release
 Best
 Davide

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p3869657.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


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-03-29 Thread Davide Sottara
The fix should have been applied today, you can find it in HEAD or in the
upcoming 5.4CR1 release
Best
Davide

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p3869657.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


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-03-05 Thread Davide Sottara
Hi Michal, 
I double checked and indeed the problem happens... it puzzles me, seems a
problem with the ASM-generated code. If you could open a JIRA, I'll try to
debug it as soon as I get a moment.
The problem happens only with legacy classes declared @Traitable, so the
immediate workaround
is to use DRL-declared beans
Thanks
Davide

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p3800419.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


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-03-05 Thread Michal Bali
Thanks Davide!, created JBRULES-3412


On Mon, Mar 5, 2012 at 11:11 AM, Davide Sottara dso...@gmail.com wrote:

 Hi Michal,
 I double checked and indeed the problem happens... it puzzles me, seems a
 problem with the ASM-generated code. If you could open a JIRA, I'll try to
 debug it as soon as I get a moment.
 The problem happens only with legacy classes declared @Traitable, so the
 immediate workaround
 is to use DRL-declared beans
 Thanks
 Davide

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p3800419.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


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-03-01 Thread Davide Sottara
This is odd... I tried to reproduce your issue but I didn't get any
exception. Trying to react to any NiceMessage also produces the expected
results...
Now, I see that you do Message.setMessage(), so I assume that Message and
NiceMessage are classes defined outside the DRL.. Could you send them so
that I can take a look?
Thanks
Davide

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p3790082.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


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-03-01 Thread Michal Bali
Hi Davide,

thanks for looking into this.
Message is a class defined outside of the DRL, its source is below.
NiceMessage is defined only inside the DRL.

public class Message {
public static final int HELLO = 0;
public static final int GOODBYE = 1;
private String message;
private int status;
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public int getStatus() {
return this.status;
}
public void setStatus(int status) {
this.status = status;
}
}

Best regards,
Michal

On Thu, Mar 1, 2012 at 11:03 AM, Davide Sottara dso...@gmail.com wrote:

 This is odd... I tried to reproduce your issue but I didn't get any
 exception. Trying to react to any NiceMessage also produces the expected
 results...
 Now, I see that you do Message.setMessage(), so I assume that Message and
 NiceMessage are classes defined outside the DRL.. Could you send them so
 that I can take a look?
 Thanks
 Davide

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p3790082.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] traits - don more than 3 pojos, got IllegalArgumentException

2012-02-29 Thread Michal Bali
Hi all,

I came across this issue when trying out 'traits' with POJOs (not declared
types). An IllegalArgumentException is being thrown when I apply the third
'don'. Here is how to reproduce:
as the POJO I am using the Message class that comes with the project
created by the Eclipse plugin.
now the rule file:

declare Message
  @Traitable

end

declare NiceMessage
  @format(trait)

end

rule load
when

then
Message message = new Message();
message.setMessage(Hello World);
insert(message);
don(message, NiceMessage.class);

Message unreadMessage = new Message();
unreadMessage.setMessage(unread);
insert(unreadMessage);
don(unreadMessage, NiceMessage.class);

Message oldMessage = new Message();
oldMessage.setMessage(old);
insert(oldMessage);
System.out.println(don  + oldMessage);
don(oldMessage, NiceMessage.class); //*--- exception happens here*
System.out.println(wont reach this point);
end

When I run this and rule 'load' fires the third 'don' will throw the
following exception:

Exception executing consequence for rule load in com.mycompany.app:
java.lang.IllegalArgumentException: argument type mismatch
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:221)
at com.mycompany.app.DroolsTest.main(DroolsTest.java:44)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at
org.drools.factmodel.traits.TraitFactory.getProxy(TraitFactory.java:92)
at
org.drools.base.DefaultKnowledgeHelper.don(DefaultKnowledgeHelper.java:502)
at
org.drools.base.DefaultKnowledgeHelper.don(DefaultKnowledgeHelper.java:522)
at
com.mycompany.app.Rule_load_86ecf966a4c14d8486844cfae2e1e0d8.defaultConsequence(Rule_load_86ecf966a4c14d8486844cfae2e1e0d8.java:21)
at
com.mycompany.app.Rule_load_86ecf966a4c14d8486844cfae2e1e0d8DefaultConsequenceInvokerGenerated.evaluate(Unknown
Source)
at
com.mycompany.app.Rule_load_86ecf966a4c14d8486844cfae2e1e0d8DefaultConsequenceInvoker.evaluate(Unknown
Source)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
... 6 more

Am I doing something wrong or is this a bug. I am running with 5.4.0.Beta2.

BTW traits are a great piece of functionality. Thank you!

Best regards,
Michal
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-02-29 Thread Mauricio Salatino
Hi Michal,
You need to change this:
declare NiceMessage
  @format(trait)

end

to this:

declare trait NiceMessage
  ..
end


Cheers

2012/2/29 Michal Bali michalb...@gmail.com

 Hi all,

 I came across this issue when trying out 'traits' with POJOs (not declared
 types). An IllegalArgumentException is being thrown when I apply the third
 'don'. Here is how to reproduce:
 as the POJO I am using the Message class that comes with the project
 created by the Eclipse plugin.
 now the rule file:

 declare Message
   @Traitable

 end

 declare NiceMessage
   @format(trait)

 end

 rule load
 when

 then
 Message message = new Message();
 message.setMessage(Hello World);
 insert(message);
 don(message, NiceMessage.class);

 Message unreadMessage = new Message();
 unreadMessage.setMessage(unread);
 insert(unreadMessage);
 don(unreadMessage, NiceMessage.class);

 Message oldMessage = new Message();
 oldMessage.setMessage(old);
 insert(oldMessage);
 System.out.println(don  + oldMessage);
 don(oldMessage, NiceMessage.class); //*--- exception happens here
 *
 System.out.println(wont reach this point);
 end

 When I run this and rule 'load' fires the third 'don' will throw the
 following exception:

 Exception executing consequence for rule load in com.mycompany.app:
 java.lang.IllegalArgumentException: argument type mismatch
 at
 org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
 at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
 at
 org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
 at
 org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
 at
 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
 at
 org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:221)
 at com.mycompany.app.DroolsTest.main(DroolsTest.java:44)
 Caused by: java.lang.IllegalArgumentException: argument type mismatch
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
 Method)
 at
 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at
 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
 at
 org.drools.factmodel.traits.TraitFactory.getProxy(TraitFactory.java:92)
 at
 org.drools.base.DefaultKnowledgeHelper.don(DefaultKnowledgeHelper.java:502)
 at
 org.drools.base.DefaultKnowledgeHelper.don(DefaultKnowledgeHelper.java:522)
 at
 com.mycompany.app.Rule_load_86ecf966a4c14d8486844cfae2e1e0d8.defaultConsequence(Rule_load_86ecf966a4c14d8486844cfae2e1e0d8.java:21)
 at
 com.mycompany.app.Rule_load_86ecf966a4c14d8486844cfae2e1e0d8DefaultConsequenceInvokerGenerated.evaluate(Unknown
 Source)
 at
 com.mycompany.app.Rule_load_86ecf966a4c14d8486844cfae2e1e0d8DefaultConsequenceInvoker.evaluate(Unknown
 Source)
 at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
 ... 6 more

 Am I doing something wrong or is this a bug. I am running with 5.4.0.Beta2.

 BTW traits are a great piece of functionality. Thank you!

 Best regards,
 Michal

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




-- 
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino Salaboy Mauricio -
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-02-29 Thread Davide Sottara
Sorry, the way to declare traits has been changed in one of the latest
versions... the code is still very experimental and subject to changes.
I think I have updated the documentation to reflect the change, but could
you please confirm that?
Thanks
Davide

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p3789031.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


Re: [rules-users] traits - don more than 3 pojos, got IllegalArgumentException

2012-02-29 Thread Michal Bali
Hi Davide, Mauricio,

I've tried that but the result is the same.
I've also tried the latest snapshot 5.4.0-SNAPSHOT

Note that the first two 'don' calls work fine, it is the third one that
fails.

Best regards,
Michal

On Thu, Mar 1, 2012 at 12:41 AM, Davide Sottara dso...@gmail.com wrote:

 Sorry, the way to declare traits has been changed in one of the latest
 versions... the code is still very experimental and subject to changes.
 I think I have updated the documentation to reflect the change, but could
 you please confirm that?
 Thanks
 Davide

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rules-users-traits-don-more-than-3-pojos-got-IllegalArgumentException-tp3788670p3789031.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