https://issues.apache.org/bugzilla/show_bug.cgi?id=55012
Bug ID: 55012
Summary: SimpleDataWriter (and other listeners) fail to
evaluate
${__BeanShell(ctx.getThreadGroup().getName())}
successfully in filename text field
Product: JMeter
Version: 2.9
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Main
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Created attachment 30315
--> https://issues.apache.org/bugzilla/attachment.cgi?id=30315&action=edit
Simple JMX file that shows error
I am trying to get the name of a threadgroup as a value to use as part of a
filename. Google suggests that to do this I should use
${__BeanShell(ctx.getThreadGroup().getName())}
but when I use it in the filename textbox of a SimpleDataWriter node
I get the following error
=============================================================================
2013/05/23 13:48:06 ERROR - jmeter.util.BeanShellInterpreter: Error invoking
bsh method: eval Sourced file: inline evaluation of:
``ctx.getThreadGroup().getName();''
2013/05/23 13:48:06 WARN - jmeter.functions.BeanShell: Error running BSH
script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval
Sourced file: inline evaluation of: ``ctx.getThreadGroup().getName();''
at
org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:192)
at
org.apache.jmeter.util.BeanShellInterpreter.eval(BeanShellInterpreter.java:198)
at org.apache.jmeter.functions.BeanShell.execute(BeanShell.java:103)
at
org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:146)
at
org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:120)
at
org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:92)
at
org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:273)
at
org.apache.jmeter.reporters.ResultCollector.getFilename(ResultCollector.java:170)
at
org.apache.jmeter.reporters.ResultCollector.initializeFileOutput(ResultCollector.java:554)
at
org.apache.jmeter.reporters.ResultCollector.testStarted(ResultCollector.java:261)
at
org.apache.jmeter.reporters.ResultCollector.testStarted(ResultCollector.java:283)
at
org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:209)
at
org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:325)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:171)
... 13 more
Caused by: Sourced file: inline evaluation of:
``ctx.getThreadGroup().getName();'' : at Line: 1 : in file: inline evaluation
of: ``ctx.getThreadGroup().getName();'' : .getName ( )
Target exception: java.lang.NullPointerException: Attempt to invoke method
getName on null value
at bsh.UtilTargetError.toEvalError(UtilTargetError.java:70)
at bsh.UtilEvalError.toEvalError(UtilEvalError.java:90)
at bsh.Reflect.invokeObjectMethod(Reflect.java:82)
at bsh.BSHPrimarySuffix.doName(BSHPrimarySuffix.java:176)
at bsh.BSHPrimarySuffix.doSuffix(BSHPrimarySuffix.java:120)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:80)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47)
at bsh.Interpreter.eval(Interpreter.java:645)
at bsh.Interpreter.eval(Interpreter.java:739)
at bsh.Interpreter.eval(Interpreter.java:728)
... 18 more
=============================================================================
others on the user mailinglist say that it works in other node types (samplers
/pre and post processors), just not listener nodes. Is this a limitation or a
bug?
I traced it as far as JMeterContext.java, where the threadGroup() method
returns NULL for some reason.
I am using:
> java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
--
You are receiving this mail because:
You are the assignee for the bug.