Mats Johansson
Mats Johansson

Reputation: 87

JMeter If Controller jexl3

In an IfController

${__jexl3("${usecase}" == "month")} # works (true) when $usecase = months

${__jexl3("${usecase}" == "month")} # do not work when $usecase = quarter?

Instead, I get

2021-05-18 16:17:57,863 ERROR o.a.j.JMeter: Uncaught exception in thread Thread[MonthTable 1-1,6,main] java.lang.StackOverflowError: null   at java.lang.ThreadLocal.get(ThreadLocal.java:163) ~[?:?]   at org.apache.jmeter.threads.JMeterContextService.getContext(JMeterContextService.java:59) ~[ApacheJMeter_core.jar:5.4.1]   at org.apache.jmeter.engine.util.SimpleVariable.getVariables(SimpleVariable.java:64) ~[ApacheJMeter_core.jar:5.4.1]     at org.apache.jmeter.engine.util.SimpleVariable.toString(SimpleVariable.java:50) ~[ApacheJMeter_core.jar:5.4.1]     at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:144) ~[ApacheJMeter_core.jar:5.4.1]     at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:113) ~[ApacheJMeter_core.jar:5.4.1]     at org.apache.jmeter.functions.Jexl3Function.execute(Jexl3Function.java:72) ~[ApacheJMeter_functions.jar:5.4.1]     at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:138) ~[ApacheJMeter_core.jar:5.4.1]     at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:113) ~[ApacheJMeter_core.jar:5.4.1]     at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:100) ~[ApacheJMeter_core.jar:5.4.1]     at org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:280) ~[ApacheJMeter_core.jar:5.4.1]   at org.apache.jmeter.control.IfController.getCondition(IfController.java:170) ~[ApacheJMeter_core.jar:5.4.1]    at org.apache.jmeter.control.IfController.next(IfController.java:230) ~[ApacheJMeter_core.jar:5.4.1]    at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222) ~[ApacheJMeter_core.jar:5.4.1]     at org.apache.jmeter.control.GenericController.next(GenericController.java:175) ~[ApacheJMeter_core.jar:5.4.1]  at org.apache.jmeter.control.LoopController.next(LoopController.java:134) ~[ApacheJMeter_core.jar:5.4.1]    at org.apache.jmeter.control.LoopController.nextIsNull(LoopController.java:166) ~[ApacheJMeter_core.jar:5.4.1]  at org.apache.jmeter.control.GenericController.next(GenericController.java:170) ~[ApacheJMeter_core.jar:5.4.1]  at org.apache.jmeter.control.LoopController.next(LoopController.java:134) ~[ApacheJMeter_core.jar:5.4.1]    at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:225) ~[ApacheJMeter_core.jar:5.4.1]

/Best regards, Mats

Upvotes: 0

Views: 3789

Answers (1)

Dmitri T
Dmitri T

Reputation: 168197

Make sure that your ${usecase} variable does really have the value using Debug Sampler and View Results Tree Listener combination as looking at the error it is not the case.

I cannot reproduce your issue using the same JMeter version

enter image description here

For non-defined variable it cannot be reproduced either.

Try getting a clean vanilla JMeter installation without any plugins and if the issue is still reproducible maybe it's connected with your Java version, in that case seeing your jmeter.log file would be very useful.

Upvotes: 1

Related Questions