Return-Path: X-Original-To: apmail-jmeter-user-archive@www.apache.org Delivered-To: apmail-jmeter-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E0E8FDFAB for ; Wed, 22 May 2013 17:01:53 +0000 (UTC) Received: (qmail 46849 invoked by uid 500); 22 May 2013 17:01:53 -0000 Delivered-To: apmail-jmeter-user-archive@jmeter.apache.org Received: (qmail 46825 invoked by uid 500); 22 May 2013 17:01:53 -0000 Mailing-List: contact user-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JMeter Users List" Delivered-To: mailing list user@jmeter.apache.org Received: (qmail 46797 invoked by uid 99); 22 May 2013 17:01:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 May 2013 17:01:52 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of shettyd@gmail.com designates 209.85.212.172 as permitted sender) Received: from [209.85.212.172] (HELO mail-wi0-f172.google.com) (209.85.212.172) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 May 2013 17:01:48 +0000 Received: by mail-wi0-f172.google.com with SMTP id m6so186412wiv.11 for ; Wed, 22 May 2013 10:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Zy5KVy5kia1C2QY440I5FUft3vmAFcL4H7eO/UOibQs=; b=KozRHL1h+aLuadRCtPAqTUIQbOqIsvtYk6mFs+uJry7GNCk03uxldNUzlhX7r7KHgX bn/Up7iG896lDddGRs32UrO7Ky3FIYCjVdbA5aE+D7geZyWlAXXLN2xBPkpwAEHR+omj Baj0HDbkC5q0+iZVgWl4nZpPYpKkXr5sFSEAp7qpXeOm7wOudoFPGAX9NjdS3qMckRJ6 w1Fv2tL/9/dcnLTltcix94NbTFSjvLzNBmCMGhyvwb4shBTzwRbMGHFziaxhcjAbkJrv PcdmQMdcS/7cSxmPjrVSq1ryuYjVSot8MkewjT/VSZjvzukt9BhwCpe73IcgwzH6NXZ2 mqtg== MIME-Version: 1.0 X-Received: by 10.180.205.206 with SMTP id li14mr35002742wic.33.1369242087200; Wed, 22 May 2013 10:01:27 -0700 (PDT) Received: by 10.194.166.7 with HTTP; Wed, 22 May 2013 10:01:27 -0700 (PDT) In-Reply-To: References: Date: Wed, 22 May 2013 10:01:27 -0700 Message-ID: Subject: Re: Get threadGroup name gives error From: Deepak Shetty To: JMeter Users List Content-Type: multipart/alternative; boundary=001a11c32b46381e6004dd51843d X-Virus-Checked: Checked by ClamAV on apache.org --001a11c32b46381e6004dd51843d Content-Type: text/plain; charset=ISO-8859-1 Hi You probably need to raise a bugzilla - it works for samplers /pre and post processors - id guess there is an implementation reason why the ThreadGroup is returned null for a listener regards deepak On Wed, May 22, 2013 at 5:49 AM, Jason Wood wrote: > Hmmm, not sure it allowed my attachment, here is the xml file > > > > > > > false > false > elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" > testname="User Defined Variables" enabled="true"> > > > > > > testname="errExample" enabled="true"> > name="ThreadGroup.on_sample_error">stopthread > elementType="LoopController" guiclass="LoopControlPanel" > testclass="LoopController" testname="Loop Controller" enabled="true"> > false > 1 > > 2 > 15 > 1362057297000 > 1362057297000 > false > > > > > testclass="ConfigTestElement" testname="HTTP Request Defaults" > enabled="true"> > guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined > Variables" enabled="true"> > > > > http://www.theregister.co.uk/ > > > > > > > 4 > > > testname="HTTP Cache Manager" enabled="true"> > false > false > > > testname="HTTP Cookie Manager" enabled="true"> > > true > > > testclass="RecordingController" testname="Recording Controller" > enabled="true"/> > > testclass="HTTPSamplerProxy" testname="/2013/05/21/geeks_guide_bt_tower/" > enabled="true"> > elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" > enabled="true"> > > > > 443 > > > https > > / > GET > true > false > true > false > false > > > > testname="HTTP Header Manager" enabled="true"> > > > name="Header.name">Accept-Language > name="Header.value">en-US,en;q=0.5 > > > Accept > > name="Header.value">text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 > > > User-Agent > Mozilla/5.0 (X11; Linux > x86_64; rv:17.0) Gecko/20130402 Firefox/17.0 > > > name="Header.name">Accept-Encoding > gzip, > deflate > > > > > > testclass="ResultCollector" testname="Simple Data Writer" enabled="true"> > false > > saveConfig > > > true > true > true > > true > true > true > true > false > true > true > false > false > false > false > false > false > true > > > false > 0 > true > > > name="filename">${__BeanShell(ctx.getThreadGroup().getName())} > > > > > > > > > > > On 21 May 2013 23:25, Deepak Shetty 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 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 > --001a11c32b46381e6004dd51843d--