[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jmeter-user
Subject:    RE: Error trying to use the __BeanShell function
From:       "mlslcan () juno ! com" <mlslcan () juno ! com>
Date:       2004-06-23 20:35:30
Message-ID: 20040623.133608.27908.81451 () webmail15 ! lax ! untd ! com
[Download RAW message or body]


Our application that I am trying to load test is a servlet based application.  The \
servlet receives data collected by agents setting on various systems via an https \
post.  There is a post parameter named Data which contains a string that contains 5 - \
20 lines of data (in CSV format with the \r\n sepreating each line).  I am trying to \
fill that parameter with data that will not violate any of the key fields when the \
servlet processes it and eventually stores it into a database.  Thus each record must \
be unique as it is created by each thread in JMeter.  I created a BeanShell Script \
(about 15 lines) that successfully created the unique lines of data.  I am thinking \
that what I am going to have to do is create one large file containing the data \
strings (containing unique data in the CSV and \r\n separated format), then allow the \
thread group to read the file line by line setting the parameter in each thread to \
the next line in the file.

Hopefully that makes sense as to what I am trying to do

Mike   

-- "BAZLEY, Sebastian" <sebastian.bazley@atosorigin.com> wrote:
Indeed, it is a script, not a script file name. I've updated the help to
make this clearer. The Function Helper (^F) is already a bit clearer.

I think you could use a script consisting of the function call 

	${_StringFromFile(scriptfile)}

and that would read a single line from the file and return it to the
beanshell function for processing. Not ideal, but it should work.

What are you actually trying to do?

S.
-----Original Message-----
From: mlslcan@juno.com [mailto:mlslcan@juno.com]
Sent: 23 June 2004 05:13
To: jmeter-user@jakarta.apache.org
Subject: Re: Error trying to use the __BeanShell function



Sebatian

Thanks for the info.  My help document referred to the first parameter as a
script (see below), so I thought a script file would be accepted.  Since I
now know differently I will have to fill the http parameter differently.  I
will probably use the CVSRead function.  Again thanks for the clarification.



16.5.13 __BeanShell

The BeanShell function evaluates the script passed to it, and returns the
result.

Parameters
Attribute	Description	Required
BeanShell script 	A script 	Yes
Name of variable 	A reference name for reusing the value computed by
this function. 	No



-- "Sebastian Bazley" <sebb@apache.org> wrote:
Unlike the Beanshell Sampler, the BeanShell function does not accept input
from a file.

Have a look at Function Help; the two parameters are:
* the expression to evaluate
* the name of the function.

A file name is not normally also valid as a java expression ... I leave as
an exercise for the reader to find one!

S.
----- Original Message ----- 
From: <mlslcan@juno.com>
To: <jmeter-user@jakarta.apache.org>
Sent: Tuesday, June 22, 2004 7:12 AM
Subject: Error trying to use the __BeanShell function


> 
> I am trying to fill in a HTTP Post parameter using some java code via a
> BeanShell script.  I receive the following error when the code executes.
> 
> 2004/06/21 22:26:17 WARN  - jmeter.functions.BeanShell:
> java.lang.reflect.InvocationTargetException
> at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
> at
> 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
jav
> a:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at org.apache.jmeter.functions.BeanShell.execute(BeanShell.java:107)
> at
> 
org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java
> 150
> )
> at
> 
org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java
> 113
> )
> at
> 
org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(Funct
ionP
> roperty.java:99)
> at
> 
org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(Abstra
ctTe
> stElement.java:234)
> at org.apache.jmeter.config.Argument.getValue(Argument.java:120)
> at
> 
org.apache.jmeter.protocol.http.util.HTTPArgument.getEncodedValue(HTTPArgume
nt.j
> ava:160)
> at
> 
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.getQueryString(HTTPS
ampl
> erBase.java:483)
> at
> 
org.apache.jmeter.protocol.http.sampler.HTTPSampler.setupConnection(HTTPSamp
ler.
> java:180)
> at
> 
org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:
465)
> 
> at
> 
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBa
se.j
> ava:585)
> at
> 
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBa
se.j
> ava:573)
> at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254)
> at java.lang.Thread.run(Thread.java:534)
> Caused by: Sourced file: inline evaluation of:
> ``C:\jakarta-jmeter-2.0.1\lib\createdata.bsh;'' Token Parsing Error:
> Lexical error at line 1, column 3.  Encountered: "\\" (92), after :
> "":
> <at unknown location>
> 
> at bsh.Interpreter.eval(Unknown Source)
> at bsh.Interpreter.eval(Unknown Source)
> at bsh.Interpreter.eval(Unknown Source)
> ... 17 more
> 
> I have tried to use various iterations of how I entered the script
> filename in the function parameter list.  Such as quoting the filename,
> including the entire path, placing it in jar file in the lib directory
> under JMeter and many others.  What is the trick to passing the filename
> to this function.  The BeanShell script runs correctly in the BeanShell
gui.
> 
> Thanks
> 
> Mike
> 
> ________________________________________________________________
> The best thing to hit the Internet in years - Juno SpeedBand!
> Surf the Web up to FIVE TIMES FASTER!
> Only $14.95/ month - visit www.juno.com to sign up today!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


________________________________________________________________
The best thing to hit the Internet in years - Juno SpeedBand!
Surf the Web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


___________________________________________________________________________

This e-mail and the documents attached are confidential and intended solely
for the addressee; it may also be privileged. If you receive this e-mail in
error, please notify the sender immediately and destroy it. As its integrity
cannot be secured on the Internet, the Atos Origin group liability cannot be
triggered for the message content. Although the sender endeavours to maintain
a computer virus-free network, the sender does not warrant that this
transmission is virus-free and will not be liable for any damages resulting
from any virus transmitted. 
___________________________________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org



________________________________________________________________
The best thing to hit the Internet in years - Juno SpeedBand!
Surf the Web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic