[rules-users] Rules in App Server Error

John McKim jmckim at comcast.net
Fri Dec 3 15:17:34 EST 2010


I'm having a problem that I can't seem to figure out.  I have rules that run
in a client program with no problem - about 125 rules in all.  When I try to
run these same rules in an App Server (GlassFish) I get several rules (about
5) that have an error on initialization.  Here is the error message followed
by the rule. 

******************************************* 
SEVERE: java.lang.RuntimeException: Unable to build expression for
'consequence': [Error: not a statement, or badly formed structure] 
[Near : {... $severity; 
                   ....}] 
                     ^ 
[Line: 1, Column: 233] '        $severity =
$patient.medicalHistoryBleedingRiskFactors.gastritis; 
        $weight = 5; 
        $factor = .1; 
        $tempScore = $factor; 
        $tempScore = $tempScore * $weight; 
        $tempScore = $tempScore * $severity; 
        // Now add this risk score to the accumlated risk score 
        $patient.score = $patient.score + $tempScore; 
        $patient.problem = new
String("MedicalHistoryBleedingRiskFactors.gastritis"); 
' : [Rule name='medicalHistoryBleedingRiskFactors.gastritis rule'] 
********************************************** 
rule "medicalHistoryBleedingRiskFactors.gastritis rule" 
salience 20 
    when 
        # find patients who indicated that they have
MedicalHistoryBleedingRiskFactors: gastritis 
        $patient : Patient(medicalHistoryBleedingRiskFactors.gastritis > 0) 
    then 
        $severity = $patient.medicalHistoryBleedingRiskFactors.gastritis; 
        $weight = 5; 
        $factor = .1; 
        $tempScore = $factor; 
        $tempScore = $tempScore * $weight; 
        $tempScore = $tempScore * $severity; 
        # Now add this risk score to the accumlated risk score 
        $patient.score = $patient.score + $tempScore; 
        $patient.problem = new
String("MedicalHistoryBleedingRiskFactors.gastritis"); 
end 

As I said, this rule runs fine in a client app - when I run the same rules
in app server I get an error.  This is only happening in 5 out of 125 rules,
and only during initialization using
builder.add(ResourceFactory.newClassPathResource(file).
Thanks.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101203/add640ed/attachment.html 


More information about the rules-users mailing list