I start using Drools in Scala by executing the example here http://www.gettingcirrius.com/2010/12/using-jboss-rules-drools-in-scala.html. However, the code is running without error but the rules are not working. The output is:
Creating Knowledge Session
Creating and insertng Temperature
Firing all rules
I found there is one solution here Help Drools integration with Scala and the revised scala code is posted in github https://github.com/mariofusco/scaladrools. However, even I copied the project, the rules are still not working, which confused me a lot.
Then, I printed some errors:
Unable to Analyse Expression System.out.println(
temp.value.toString + " F is too hot."
+ " Declare HEAT WARNING!");:
[Error: unable to resolve method using strict-mode: int.toString()]
[Near : {... temp.value.toString + " F is too hot." ....}]
^
[Line: 13, Column: 0]
Unable to Analyse Expression System.out.println(
temp.value.toString + " F is too cold."
+ " Declare FREEZE WARNING!" );:
[Error: unable to resolve method using strict-mode: int.toString()]
[Near : {... temp.value.toString + " F is too cold." ....}]
^
[Line: 23, Column: 0]
It seems that the toString
method in drl file is the primary problem. So I delete the .toString
in drl, everything works just fine. The drool package version I'm using is 6.0.1.Final and when I changed it to 5.4.0.Final, it doesn't change anything. Those problems just made me crazy. Can anyone help me? Thanks very much!