Thanks. In other words, I wonder that what I can do with bsh remoter server. 
And now I know that I can get/set the properties and can stop the engine.











在 2020-09-18 22:52:48,"Felix Schumacher" <[email protected]> 写道:
>
>Am 18.09.20 um 15:29 schrieb 李旭东:
>> Thanks for your help.
>> I misunderstood the user variables. I will use the properties of JMeter.
>> At first I thought that all of the extras/*.bshs were for BeanShell Server 
>> Mode. And now I know that the printvars.sh is not for BeanShell Server.
>> I used to set throughput with user variables, that's why I wanted to get and 
>> set the user variables with remote bsh feature. And now I will use the 
>> properties to set throughput.
>> I have a little question. Is everything that can be done in the startup.bsh? 
>> We can use remote bsh to access the properties, to stop the thread or 
>> engine. The functions not written in the startup.sh are not easy to 
>> implement.
>
>Could you try to rephrase your question? I haven't understood, what you
>want to achieve.
>
>With the bsh server inside JMeter you get access to the running JVM. The
>examples from extras/startup.bsh use the fact that most entry points in
>JMeter are static methods like StandardJMeterEngine#stopEngine. Have a
>look at the API or the sources to find the methods you want to use, or
>tell us, what you want to achieve. Maybe someone else has already done it.
>
>Felix
>
>>
>>
>>
>>
>>
>>
>>
>> At 2020-09-17 01:25:05, "Felix Schumacher" 
>> <[email protected]> wrote:
>>> Hi,
>>>
>>> why do you think, that printvars.bsh can be used together with the
>>> remote bsh feature?
>>>
>>> I have had no idea, that we ship with it :) but I don't think, that you
>>> can easily access vars from the beanshell server. The reasoning here is,
>>> that variables belong to a running thread of a thread group. You would
>>> have to dig up the correct threadgroup first and then dig further to get
>>> the correct JMeterThread on which the variables are defined.
>>>
>>> You can access the properties of JMeter, though. If I read the
>>> documentation correctly, you can specify the script extras/startup.sh as
>>> a beanshell startup script and use the extras/remote.bsh script as an
>>> example for that.
>>>
>>> Felix
>>>
>>> Am 16.09.20 um 17:51 schrieb 李旭东:
>>>> The JMeter Version is 5.3.
>>>> The BeanShell Server is opened at port 9000.
>>>> I try to run the apache-jmeter-5.3/extras/printvars.bsh, the command is 
>>>> java -jar ../lib/bshclient.jar localhost 9000 ./printvars.bsh
>>>> But I got the error messages. Below is it.
>>>> -------------Error Message Start--------------------
>>>>
>>>> Connecting to BSH server on localhost:9000
>>>> Reading responses from server ...
>>>> BeanShell 2.0b6 - by Pat Niemeyer ([email protected])
>>>> bsh % >>>>
>>>> // Error: EvalError: Typed variable declaration : Attempt to resolve 
>>>> method: getIterator() on undefined variable or class name: vars : at Line: 
>>>> 21 : in file: <unknown file> : vars .getIterator ( )
>>>>
>>>> // Error: EvalError: Attempt to resolve method: hasNext() on undefined 
>>>> variable or class name: i : at Line: 22 : in file: <unknown file> : i 
>>>> .hasNext ( )
>>>>
>>>> <<<<
>>>> bsh % ... disconnected from server.
>>>> -------------Error Message END--------------------
>>>> The printvars.sh is under the extras directory.
>>>>
>>>> ------------Below is the contents of printvars.bsh.----------------
>>>> // Sample script to print JMeter variables
>>>> print(">>>>");
>>>> Iterator i = vars.getIterator();
>>>> while(i.hasNext())
>>>> {
>>>>       Map.Entry me = i.next();
>>>>        if(String.class.equals(me.getValue().getClass())){
>>>>              print(me);
>>>>       }
>>>> }
>>>> print("<<<<");
>>>>
>>>> ------------Above is the contents of printvars.bsh.----------------
>>>> Also I tried the functions like vars.get, vars.put. All of them did not 
>>>> work. It seems that they were not defined.
>>>> I want to know how to get/change the variables in the BeanShell Server.
>>>> Thanks.
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]

Reply via email to