【发布时间】:2018-12-21 01:05:46
【问题描述】:
我正在使用 JSR223 Sampler 并尝试进行算术运算..
try {
setStrictJava(true);
int a=1;
int b=2;
int c = a+b;
vars.put("c",c);
} catch(Exception ex) {
log.error("something wrong", ex);
throw ex;
}
出现以下错误..
2018-12-18 18:19:59,554 ERROR o.a.j.p.j.s.JSR223Sampler: Problem in JSR223 script JSR223 Sampler, message: javax.script.ScriptException: Sourced file: inline evaluation of: ``try{ setStrictJava(true); int a=1; int b=2; int c = a+b; vars.put("c",c); } catc . . . '' : Error in method invocation: Method put( java.lang.String, int ) not found in class'org.apache.jmeter.threads.JMeterVariables' : at Line: 6 : in file: inline evaluation of: ``try{ setStrictJava(true); int a=1; int b=2; int c = a+b; vars.put("c",c); } catc . . . '' : vars .put ( "c" , c )
in inline evaluation of: ``try{ setStrictJava(true); int a=1; int b=2; int c = a+b; vars.put("c",c); } catc . . . '' at line number 6
javax.script.ScriptException: Sourced file: inline evaluation of: ``try{ setStrictJava(true); int a=1; int b=2; int c = a+b; vars.put("c",c); } catc . . . '' : Error in method invocation: Method put( java.lang.String, int ) not found in class'org.apache.jmeter.threads.JMeterVariables' : at Line: 6 : in file: inline evaluation of: ``try{ setStrictJava(true); int a=1; int b=2; int c = a+b; vars.put("c",c); } catc . . . '' : vars .put ( "c" , c )
如何解决?
【问题讨论】:
标签: jmeter