Java classes in JMeter with Beanshell sampler -
i have java project need run load test in jmeter. found examples indicated make jar file , put in jmeter lib/ext folder , run it. works simple example program wrote.
tried scale up, made jar of larger project, placed in lib/ext folder, did following in beanshell sampler following example program.
import package.jhelper; jhelper x = new jhelper(); x.test();
i have tried import class using full path of
import cast.sa.vsp.package.jhelper; import cast.sa.vsp.package.*;
both return me following response code
response message: org.apache.jorphan.util.jmeterexception: error invoking bsh method: eval sourced file: inline evaluation of: ``import cast.sa.vsp.package.jhelper; jhelper x = new jhelper(); . . . '' : typed variable declaration : class: jhelper not found in namespace
the answer have seen work if moved /lib/ext /lib. have done well, jmeter being unable run until remove jar directory.
does have advice on how working?
- your jars should go /lib folder (instead of /lib/ext)
- jmeter restart absolutely required pick jars up
- it not recommended use beanshell creating actual load, consider switching jsr223 sampler using "groovy" language instead.
for details on jsr223 sampler performance, instructions on how install groovy scripting engine , performance benchmarks see beanshell vs jsr223 vs java jmeter scripting: performance-off you've been waiting for! article.
Comments
Post a Comment