Swathi
Swathi

Reputation: 1

Class or variable not found: INF.classes.com.rbs.ccr.saturn.eventbridge.constants.EventBridgeConstants

My class path looks like below in jar and trying to load class in JMeter BeanShell Sampler and my java version is Java8 but getting error

C:\Jars\saturn-event-bridge-1.1.2-SNAPSHOT.jar\BOOT-INF\classes\com\rbs\ccr\saturn\eventbridge\constants\

Beanshell script:

package BOOT-INF.classes.com.rbs.ccr.saturn.eventbridge.constants.EventBridgeConstants;
EventBridgeConstants constant = new EventBridgeConstants();
a=constant.toString();
System.out.println(a);

But when i run script in Jmeter version 3.2 getting below error

Error: Response code: 500 Response message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``package BOOT-INF.classes.com.rbs.ccr.saturn.eventbridge.constants.EventBridgeCon . . . '' : Class or variable not found: INF.classes.com.rbs.ccr.saturn.eventbridge.constants.EventBridgeConstants

Is my script is correct for loading java class in JMeter. Please help here

Can you help me resolving issue

Upvotes: 0

Views: 34

Answers (1)

Dmitri T
Dmitri T

Reputation: 168207

  1. Copy saturn-event-bridge-1.1.2-SNAPSHOT.jar and all its dependencies if any to "lib" folder of your JMeter installation or amend user.classpath property to point to the folder where your .jars are located

  2. Restart JMeter to pick the .jar(s) up

  3. Change first line to look like:

    import com.rbs.ccr.saturn.eventbridge.constants.EventBridgeConstants;
    
  4. Your script should start working normally

Also consider:

  1. Migrating to JSR223 Sampler with Groovy as Groovy is the recommended scripting option since JMeter 3.1
  2. Upgrading to JMeter 5.5 or whatever is the latest stable version which is available at JMeter Downloads page as it's recommended to use the latest version of JMeter

Upvotes: 0

Related Questions