Carl,
Drools 4.0.x is indeed JDK 1.4+ compatible.
Can you please share your complete stack trace?
The snippet you showed:
Caused by: java.lang.NoSuchMethodError: java.lang.Integer.valueOf(I
)Ljava/lang/Integer;
at AL_Calculation.Rule_ setSelecte_10_0.consequence(Unknown Source)
Says that the problem is happening the consequence of a rule called
something like:
"setSelecte_10_0"
Where _ is any non-valid character for classnames.
That is not the rule you showed before.
[]s
Edson
2008/5/8 Cabou, Carl <Carl.Cabou(a)prima-solutions.com>:
So Does anybody know how I can make Drools 4 API works in JAVA1.4 ??
Carl
-----Message d'origine-----
De : rules-users-bounces(a)lists.jboss.org [mailto:
rules-users-bounces(a)lists.jboss.org] De la part de Cabou, Carl
Envoyé : jeudi 8 mai 2008 10:41
À : Rules Users List
Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
Thomas,
I can not move the headings since I do receive "0 - 50" as a String and
then I have to return an Integer.
I've made a little program beside this to test my rule, I've launched it
using java5, it worked fine, but it does crash using java1.4.
I just found out the Integer.valueOf(int) is a new feature of java5.
So I guess I must try to run my web application using java5.
Carl.
-----Message d'origine-----
De : rules-users-bounces(a)lists.jboss.org [mailto:
rules-users-bounces(a)lists.jboss.org] De la part de Hehl, Thomas
Envoyé : jeudi 8 mai 2008 10:20
À : 'Rules Users List'
Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
No, really, java uses the valueOf methods internally to try to convert the
object specified (a String) into an Integer so it can do the comparison.
You
can't do selected == "0 - 50" because "0 - 50" is a String and
you cant
compare it to an Integer.
So what are you trying to do? If you want selected to be in the range
between 0 and 50 inclusive, then you need to change the heading in your
decision table. Here's an example:
daysBeforeSummons >= $1, daysBeforeSummons <= $2
and then you specify the data in your column as 0,50.
Good luck!
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Cabou, Carl
Sent: Thursday, May 08, 2008 10:12 AM
To: Rules Users List
Subject: RE: [rules-users] Newbie question / NoSuchMethodError error
Thank you for answering Thomas.
Here is the code below, nothing fancy:
public void setSelected (Integer calculatedSetSelected)
{
this. calculatedSetSelected = calculatedSetSelected;
}
In fact, the problem IS that it is taking an Integer and some Drools
Internal method want to convert it using Integer.valueOf, but there is no
Integer.valueOf taking Integer.
There is something weird, in the stack trace, I get :
Caused by: java.lang.NoSuchMethodError:
java.lang.Integer.valueOf(I)Ljava/lang/Integer;
at AL_Calculation.Rule_ setSelecte_10_0.consequence(Unknown Source)
There is a missing "d" before "_10" ...
Carl
-----Message d'origine-----
De : rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] De la part de Hehl, Thomas
Envoyé : jeudi 8 mai 2008 09:35
À : 'Rules Users List'
Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
Yep. Post the code for setSelected(). I'm guessing it takes an Integer or
int and you're passing it a String.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Cabou, Carl
Sent: Thursday, May 08, 2008 9:23 AM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Newbie question / NoSuchMethodError error
Greetings,
I'm new to Drools and I've written a decision table based rule using excel.
The rule validates ok and I've deployed my package fine.
I've written a piece of code to test my rules, I want to set the
calculatedRate to 125 when I get selected field equal to "0 - 50" :
...
StatelessSession statelessSession = rb.newStatelessSession(); Data data=new
Data(); data.setSelected("0 - 50"); statelessSession.execute(data); // set
private Integer field ...
When I run the code I get a exeption :
java.lang.NoSuchMethodError:
java.lang.Integer.valueOf(I)Ljava/lang/Integer;
I don't understand why Drools tries to convert to Integer something which
is
already Integer !!!!
-----------
Here is the rules code.
rule "setCalculateRate_11"
salience 65525
when
Data(selected == "0 - 50")
then
object.setCalculatedRate(125);
end
--------------
The CalculatedRate field is a java.lang.Integer object.
Does anybody has an idea ??
Regards,
Carl.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @