[rules-users] BuildError: Unable to Analyse Expression var == "a"

richie haoruiqian at gmail.com
Fri Oct 11 05:06:02 EDT 2013


Why var can not be used in the when clause? I tried to use it in then clause
such as modify ($d) {var = "d"}; it just worked well.

Is var a keyword in drools or mvel? I didn't find it anywhere both in drools
export doc and mvel guide.

Following is the content of my drl file:

package test

declare Dd
@propertyReactive
var : String
age : Integer
end

rule "Rule A"
dialect "mvel"
salience 0
no-loop
when
$d:Dd(var == "a")
then
modify ($d) {age = 3};
end

In the eclipse editor, it just shows an error marker before line $d:Dd(var
== "a"):
BuildError: Unable to Analyse Expression var == "a":
[Error: unexpected end of statement]
[Near : {... var == "a" ....}]
                 ^
[Line: 14, Column: 0]

And when invoke the rule, it just threw following exception:
java.lang.RuntimeException: Error while creating KieBase[Message [id=1,
level=ERROR, path=rules/Sample.drl, line=14, column=0
   text=Unable to Analyse Expression var == "a":
[Error: unexpected end of statement]
[Near : {... var == "a" ....}]
                 ^
[Line: 14, Column: 0]]]
	at
org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:176)
	at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:315)
	at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:290)
	at com.sample.DroolsTest.main(DroolsTest.java:18)


I really appreciate any help you can provide.



--
View this message in context: http://drools.46999.n3.nabble.com/BuildError-Unable-to-Analyse-Expression-var-a-tp4026331.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list