I am getting error when I am using Beanshell Sampler with script in jmeter as Could not initialize class

624 Views Asked by At

My code is

import com.ilume.jti.test.controller.romania.*;

RomaniaRoutingControllerTest obj = new RomaniaRoutingControllerTest();

but i got following error

Response code: 500 Response message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Could not initialize class com.ilume.jti.test.controller.romania.RomaniaRoutingControllerTest

I have add directory path of my test project, .jar file of test project and add bsh-2.0.jar in user plan in jmeter. i use jameter version 3.1

can some one help me to solve above error

1

There are 1 best solutions below

0
On

JMeter 3.1 comes with bsh-2.0b5.jar so you don't need to add anything. All you need to do is:

  1. To put the .jar containing RomaniaRoutingControllerTest class to the "lib/ext" folder of your JMeter installation
  2. Add dependency .jar files (if any) to "lib" folder of your JMeter installation
  3. Restart JMeter to pick the jar up

If you still be receiving errors after completing the above steps amend your script as follows:

debug();
import com.ilume.jti.test.controller.romania.*;

try {
    RomaniaRoutingControllerTest obj = new RomaniaRoutingControllerTest();
}
catch (Throwable ex) {
    log.error("Initializing RomaniaRoutingControllerTest failure", ex);
    throw ex;
}

and provide the output from both JMeter Console and jmeter.log. See How to Debug your Apache JMeter Script article for more information in regards to how to troubleshoot your JMeter tests.