Reputation: 67
I have stuck with below error in jmeter
.
Response code: 500 Response message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval In file: inline evaluation of'
bean shell code:
import tools.JmeterTools;
JmeterTools jt = new JmeterTools();
int num = Integer.parseInt(vars.get("A1"));
num = jt.randInt(num);
vars.put("A1", num.toString());
num = Integer.parseInt(vars.get("B1"));
num = jt.sqrInt(num);
vars.put("B1", num.toString());
vars.put("B2", jt.sqrstr(vars.get("B2")));
}
eclipse code:
package tools;
import java.util.Random;
public class JmeterTools {
public JmeterTools(){
}
public int randInt (int x){
Random randomGenerator= new Random();
return randomGenerator.nextInt(x);
}
public int sqrInt(int x){
return x*x;
}
public String sqrstr(String x){
int y= Integer.parseInt(x);
return String.valueOf(y*y);
}
}
Upvotes: 0
Views: 1701
Reputation: 34556
Did you:
Also, you have a } at end of your beanshell code that shouldn't be there.
Upvotes: 1