简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM