简体   繁体   English

Jmeter-JSR223错误:无法遍历类型:com.couchbase.client.java.query.DefaultN1qlQueryResult类

[英]Jmeter - JSR223 Error: Can't iterate over type: class com.couchbase.client.java.query.DefaultN1qlQueryResult

I have a java code and validating them on JSR 223 Preprocessor.. When i validated, i have found below error message: 我有一个Java代码,并在JSR 223预处理程序上对其进行了验证。当我通过验证时,发现以下错误消息:

Can't iterate over type: class com.couchbase.client.java.query.DefaultN1qlQueryResult 无法遍历类型:com.couchbase.client.java.query.DefaultN1qlQueryResult类

Any idea/advice to resolve the above error message? 解决上述错误消息的任何想法/建议吗? Here is code: 这是代码:

if(queryResult != null && !queryResult.allRows().isEmpty()){
        System.out.println("RESULT CONTENTS :" + queryResult.allRows());
        for (N1qlQueryRow row : queryResult) {
      System.out.println(row.value().getObject("uiux-image") + "\n");
      try {
        System.out.println(
            "prg image value iss" + row.value().getObject("uiux-image").getString("resourceId") + "\n");
        resource = row.value().getObject("uiux-image").getString("resourceId");

My expectation is that you should change this line: 我的期望是您应该更改此行:

for (N1qlQueryRow row : queryResult) {

to this one: 对此:

for (N1qlQueryRow row : queryResult.allRows()) {

Also given you use JSR223 PreProcessor I would recommend switching to Groovy language as "Java" language selected in the dropdown stands for Beanshell interpreter. 同样,如果您使用JSR223 PreProcessor,我建议您切换到Groovy语言,因为在下拉菜单中选择的“ Java”语言代表Beanshell解释器。 See Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For! 请参见Beanshell,JSR223和Java JMeter脚本:您一直在等待的性能下降! article for better explanation of why Groovy is better and scripting best practices. 更好地解释为什么Groovy更好并编写最佳实践脚本的文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM