I have a .jmx within which there is a .bsh being invoked and it is failing there with the below error: I need to troubleshoot and figure out the root cause. Any pointers in this regard would be great. I have this .jmx being invoked from within Java application but I get the same error during execution both from Java application and Jmeter tool.
2018/09/26 16:18:55 ERROR – jmeter.util.BeanShellInterpreter: Error invoking bsh method: source Sourced file: src/test/resources/TT.bsh 2018/09/26 16:18:55 WARN – jmeter.protocol.java.sampler.BeanShellSampler: org.apache.jorphan.util.JMeterException: Error invoking bsh method: source Sourced file: src/test/resources/TT.bsh
Advertisement
Answer
Put your code inside a global try block like
try { //your code here } catch (Exception ex) { log.error("Failure in script", ex"); }
This way you will have “normal” Java stacktrace in jmeter.log file
Another option is adding debug();
directive to the beginning of your script – this will toggle debugging mode and you will get extra information in the console window where you launch JMeter (in other words in STDOUT)
For your consideration: starting from JMeter 3.1 it is recommended using JSR223 Test Elements and Groovy language for scripting, the main reason is that Groovy performance is much better comparing to Beanshell so consider migrating to Groovy on next available opportunity.