3
votes

I am trying to use beanshell on jmeter (last version), but everytime I add a beanshell processor (pre, pro or whatever), I got this error

ERROR - jmeter.util.BeanShellTestElement: Cannot find BeanShell: java.lang.ClassNotFoundException: bsh.Interpreter 

Ubuntu last stable versione, jmeter last stable version(2.13) I don't understand what I need to do..

Any suggestions? Thanks in advance!

EDIT: here full logs:

2016/03/02 14:44:05 INFO - jmeter.util.JMeterUtils: Setting Locale to en_IE 2016/03/02 14:44:05 INFO - jmeter.JMeter: Loading user properties from: /home/asada/Downloads/apache-jmeter-2.13/bin/user.properties 2016/03/02 14:44:05 INFO - jmeter.JMeter: Loading system properties from: /home/asada/Downloads/apache-jmeter-2.13/bin/system.properties 2016/03/02 14:44:05 INFO - jmeter.JMeter: Copyright (c) 1998-2012 The Apache Software Foundation 2016/03/02 14:44:05 INFO - jmeter.JMeter: Version 2.8.20130705 2016/03/02 14:44:05 INFO - jmeter.JMeter: java.version=1.8.0_72 2016/03/02 14:44:05 INFO - jmeter.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM 2016/03/02 14:44:05 INFO - jmeter.JMeter: os.name=Linux 2016/03/02 14:44:05 INFO - jmeter.JMeter: os.arch=amd64 2016/03/02 14:44:05 INFO - jmeter.JMeter: os.version=3.19.0-49-generic 2016/03/02 14:44:05 INFO - jmeter.JMeter: file.encoding=UTF-8 2016/03/02 14:44:05 INFO - jmeter.JMeter: Default Locale=English (Ireland) 2016/03/02 14:44:05 INFO - jmeter.JMeter: JMeter Locale=English (Ireland) 2016/03/02 14:44:05 INFO - jmeter.JMeter: JMeterHome=/usr/share/jmeter 2016/03/02 14:44:05 INFO - jmeter.JMeter: user.dir =/home/asada/Downloads/apache-jmeter-2.13/bin 2016/03/02 14:44:05 INFO - jmeter.JMeter: PWD
=/home/asada/Downloads/apache-jmeter-2.13/bin 2016/03/02 14:44:05 INFO - jmeter.JMeter: IP: 127.0.1.1 Name: asada-Precision-WorkStation-T5500 FullName: asada-Precision-WorkStation-T5500 2016/03/02 14:44:05 INFO - jmeter.JMeter: Loaded icon properties from org/apache/jmeter/images/icon.properties 2016/03/02 14:44:06 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must contain the string: '.functions.' 2016/03/02 14:44:06 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must not contain the string: '.gui.' 2016/03/02 14:44:07 INFO - jmeter.gui.action.LookAndFeelCommand: Using look and feel: javax.swing.plaf.metal.MetalLookAndFeel [Metal, CrossPlatform] 2016/03/02 14:44:08 INFO - jmeter.util.BSFTestElement: Registering JMeter version of JavaScript engine as work-round for BSF-22 2016/03/02 14:44:08 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Cannot find .className property for htmlParser, using default 2016/03/02 14:44:08 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/html is 2016/03/02 14:44:08 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for application/xhtml+xml is 2016/03/02 14:44:08 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for application/xml is 2016/03/02 14:44:08 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/xml is 2016/03/02 14:44:08 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/vnd.wap.wml is org.apache.jmeter.protocol.http.parser.RegexpHTMLParser 2016/03/02 14:44:08 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Reuse SSL session context on subsequent iterations: true 2016/03/02 14:44:08 INFO - jmeter.gui.util.MenuFactory: Skipping org.apache.jmeter.protocol.http.modifier.gui.ParamModifierGui 2016/03/02 14:44:08 INFO - jmeter.samplers.SampleResult: Note: Sample TimeStamps are START times 2016/03/02 14:44:08 INFO - jmeter.samplers.SampleResult: sampleresult.default.encoding is set to ISO-8859-1 2016/03/02 14:44:08 INFO - jmeter.samplers.SampleResult: sampleresult.useNanoTime=true 2016/03/02 14:44:08 INFO - jmeter.samplers.SampleResult: sampleresult.nanoThreadSleep=5000 2016/03/02 14:44:24 ERROR - jmeter.util.BeanShellInterpreter: Beanshell Interpreter not found 2016/03/02 14:44:24 ERROR - jmeter.util.BeanShellTestElement: Cannot find BeanShell: java.lang.ClassNotFoundException: bsh.Interpreter 2016/03/02 14:44:29 ERROR - jmeter.util.BeanShellTestElement: Cannot find BeanShell: java.lang.ClassNotFoundException: bsh.Interpreter 2016/03/02 14:44:29 ERROR - jmeter.util.BeanShellTestElement: Cannot find BeanShell: java.lang.ClassNotFoundException: bsh.Interpreter 2016/03/02 14:44:29 INFO - jmeter.engine.StandardJMeterEngine: Listeners will be started after enabling running version 2016/03/02 14:44:29 INFO - jmeter.engine.StandardJMeterEngine: To revert to the earlier behaviour, define jmeterengine.startlistenerslater=false 2016/03/02 14:44:29 INFO - jmeter.engine.StandardJMeterEngine: Running the test! 2016/03/02 14:44:29 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(true,local) 2016/03/02 14:44:30 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group 2016/03/02 14:44:30 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group. 2016/03/02 14:44:30 INFO - jmeter.engine.StandardJMeterEngine: Thread will continue on error 2016/03/02 14:44:30 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1 perThread 1000.0 delayedStart=false 2016/03/02 14:44:30 INFO - jmeter.threads.JMeterThread: jmeterthread.startearlier=true (see jmeter.properties) 2016/03/02 14:44:30 INFO - jmeter.threads.JMeterThread: Running PostProcessors in forward order 2016/03/02 14:44:30 ERROR - jmeter.util.BeanShellTestElement: Cannot find BeanShell: java.lang.ClassNotFoundException: bsh.Interpreter 2016/03/02 14:44:30 ERROR - jmeter.util.BeanShellTestElement: Cannot find BeanShell: java.lang.ClassNotFoundException: bsh.Interpreter 2016/03/02 14:44:30 INFO - jmeter.threads.ThreadGroup: Started thread group number 1 2016/03/02 14:44:30 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started 2016/03/02 14:44:30 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1 2016/03/02 14:44:30 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1 2016/03/02 14:44:30 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test 2016/03/02 14:44:30 INFO - jmeter.services.FileServer: Default base='/home/asada/Downloads/apache-jmeter-2.13/bin' 2016/03/02 14:44:30 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(false,local)

3

3 Answers

4
votes

Double check your JMeter installation, it should contain bsh-2.0b5.jar. If it doesn't - download it from i.e. http://repo1.maven.org/maven2/org/beanshell/bsh/2.0b5/bsh-2.0b5.jar and drop to /lib folder of your JMeter installation. If you installed it from Ubuntu repositories it can be something like /usr/share/jmeter/lib/

Just in case take the following steps:

  1. Create a new Ubuntu user and log into its account.
  2. Download the latest version of Oracle Java Server JRE or JDK an unpack it somewhere
  3. Set JAVA_HOME system variable pointing to Java installation folder and add $JAVA_HOME/bin to PATH variable like:

    JAVA_HOME=/opt/java && export JAVA_HOME
    PATH=$JAVA_HOME/bin:$PATH && export PATH
    
  4. Download JMeter 2.13 (or newer) and unpack it somewhere
  5. In the same terminal window you set JAVA_HOME and PATH navigate to /bin folder of your JMeter installation and type ./jmeter

If the problem still persists - post full jmeter.log file contents here.

If there will be nothing suspicious in the jmeter.log file - add

debug();

line at the beginning of your Beanshell script and inspect terminal output.

2
votes

I have faced similar issue. It could be due to your JAVA_TOOLS_OPTIONS.

Remove that, Relaunch everything and Try again.


  1. Close the terminal
  2. ReLaunch the terminal
  3. type jmeter (or ./jmeter)and hit enter

Now - What do you see in the Terminal once jmeter is launched?

0
votes

Now It works.

With windows I never had a single problem. BTW I did:

  1. sudo apt-get remove jmeter
  2. delete the folder where I had the second jmeter in my pc.
  3. I update the java alternatives and I choose the java 8 with both commands: sudo update-alternatives --config java sudo update-alternatives --config javac
  4. Restart the pc
  5. Download again jmeter
  6. this time I moved the dir on /opt/apache-jmeter-2.13.
  7. I went in bin and I just ran ./jmeter.

This time without errors. I really don't know what was the problem.