几个成功的样本后jmeter空指针异常

时间:2014-09-03 01:14:36

标签: jmeter

我有一个jmeter测试计划,登录到一个站点模拟一些ajax请求,模拟点击几个随机页面然后循环。

问题是经过一些成功的示例后,我开始获得 null property can't be cast 例外:

java.lang.ClassCastException: org.apache.jmeter.testelement.property.NullProperty cannot be cast to org.apache.jmeter.testelement.property.CollectionProperty
    at org.apache.jmeter.config.Arguments.getArguments(Arguments.java:54)
    at org.apache.jmeter.config.Arguments.iterator(Arguments.java:145)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.getQueryString(HTTPSamplerBase.java:966)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.getUrl(HTTPSamplerBase.java:924)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1094)
    at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
    at java.lang.Thread.run(Unknown Source)

它看起来非常类似于2.11中明显解决的以下问题

Apache jmeter - 2.10 - Null point exception while running an existing script

但我认为这有点不同。 有什么建议吗?谢谢!

1 个答案:

答案 0 :(得分:0)

我在使用时遇到了类似的问题:

${__BeanShell( if(vars.get("GroupingThreads")=="1") {return "Debug Sampler";}else {return ctx.getThreadGroup().getName()+"-"+${__threadNum()}+"-"+": Debug Sampler";})}

经过几次工作,然后返回错误(也在客户端机器上)

然后我改为:

${__BeanShell( if("${GroupingThreads}"=="1") {return "Debug Sampler";}else {return ctx.getThreadGroup().getName()+"-"+${__threadNum()}+"-" + "${var_Username}"+": Debug Sampler";})} 

现在,测试工作没有错误