0

I have a java code and validating them on JSR 223 Preprocessor.. When i validated, i have found below error message:

Can't iterate over type: class 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");

1 Answers1

0

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. See Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For! article for better explanation of why Groovy is better and scripting best practices.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133