[rules-users] Drools 5.4 Jitting Error

jgeuns jgeuns at gmail.com
Wed Oct 10 17:08:08 EDT 2012


FYI, I came across a similar problem calling a method declared on a Java
helper class, when the method takes a Number and the value passed in is
declared as long or int. Problem does not occur when value is declared as
double.

Simplified version of my example:
class JavaHelper {
	public boolean helperMethod(Number value) {
		return true;
	}
}

............

declare BusinessObject
	LongAttribute : long
	DoubleAttribute : double
end

............

rule "TestRule"
    when
    	$helper: JavaHelper ()
	$object: BusinessObject ( 
		$helper.helperMethod(LongAttribute)
	) 
    then
		// ....
end

This gives the exception shown below. Exception goes away when replacing
LongAttribute with DoubleAttribute. 

One workaround is to create multiple versions of helperMethod:
 	public boolean helperMethod(long value) {..}
 	public boolean helperMethod(double value) {..}

=============
Exception in thread "Thread-5" java.lang.RuntimeException: Exception
jitting: $helper.helperMethod(LongAttribute)
	at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:219)
	at
org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)
	at org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.VerifyError: (class:
ConditionEvaluatorc78edf31751242d095abbdec5e344aa4, method: evaluate
signature:
(Ljava/lang/Object;Lorg/drools/common/InternalWorkingMemory;Lorg/drools/reteoo/LeftTuple;)Z)
Expecting to find long on stack
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
	at java.lang.Class.getConstructor0(Class.java:2699)
	at java.lang.Class.getConstructor(Class.java:1657)
	at
org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:173)
	at
org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)
	at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:217)
	... 5 more
	




--
View this message in context: http://drools.46999.n3.nabble.com/Drools-5-4-Jitting-Error-tp3999176p4020203.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list