AI智能
改变未来

jmeter使用beanshell报错Typed variable declaration : Class: JSONObject not found in namespace


【问题描述】

jmeter使用beanshell断言报错:
2020-07-31 11:56:49,536 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of:

import org.json.*; String response = prev.getResponseDataAsString(); JSONObje . . . \'\' : Typed variable declaration : Class: JSONObject not found in namespace 2020-07-31 11:56:49,536 WARN o.a.j.a.BeanShellAssertion: Error in BeanShellAssertion org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval	Sourced file: inline evaluation of:

import org.json.*; String response = prev.getResponseDataAsString(); JSONObje . . . ‘’ : Typed variable declaration : Class: JSONObject not found in namespace
at org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:180) ~[ApacheJMeter_core.jar:5.2.1]

【问题分析】

需要json.jar包

【解决方案】

1、下载json.jar包放到jmeter的lib目录下

2、重启jmeter

【验证】

再次执行OK,不需要在测试计划中引入json.jar包

赞(0) 打赏
未经允许不得转载:爱站程序员基地 » jmeter使用beanshell报错Typed variable declaration : Class: JSONObject not found in namespace