I have attached a simple example. I basically use the
${__BeanShell(ctx.getThreadGroup().getName())}
in the filename text box of a Simple Data Writer node.

On 21 May 2013 23:25, Deepak Shetty <[email protected]> wrote:

> works fine for me in 2.9
> Whats your exact script and structure?
>
>
> On Tue, May 21, 2013 at 6:10 AM, Jason Wood <[email protected]> wrote:
>
> > Hi,
> >
> >     I am trying to get the name of my threadgroup to use for logfile
> > creation. The advice
> > that I see from googling is to use
> >
> > ${__BeanShell(ctx.getThreadGroup().getName())}
> >
> > but this gives me
> >
> > 2013/05/21 14:05:26 INFO  - jmeter.engine.StandardJMeterEngine: Running
> the
> > test!
> > 2013/05/21 14:05:26 ERROR - jmeter.util.BeanShellInterpreter: Error
> > invoking bsh method: eval    Sourced file: inline evaluation of:
> > ``ctx.getThreadGroup().getName();''
> > 2013/05/21 14:05:26 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
> >
> >
> kg.apc.jmeter.reporters.FlexibleFileWriter.getFilename(FlexibleFileWriter.java:110)
> >     at
> >
> >
> kg.apc.jmeter.reporters.FlexibleFileWriter.openFile(FlexibleFileWriter.java:187)
> >     at
> >
> >
> kg.apc.jmeter.reporters.FlexibleFileWriter.testStarted(FlexibleFileWriter.java:78)
> >     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)
> >     ... 12 more
> > Caused by: Sourced file: inline evaluation of:
> > ``ctx.getThreadGroup().getName();'' : at Line: 1 : in file: inline
> > evaluation of: ``ctx.getThreadGroup().getName();'' : .getName ( )
> >
> >
> >
> > I am using JMeter 2.9. I have poked around in the src and found that
> > context has a virtual getThreadGroup() method so am wondering if whatever
> > is supposed
> > to be supplying it is in error. Randomly calling other methods of
> > JMeterContext such as getThread() don't cause an error (but obviously
> don't
> > return what
> > I want to generate a filename).
> >
> > I presume this used to work . . .
> >
> > --
> > ------------------------------
> > jason
> >
>



-- 
------------------------------
jason
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to