AFAIK BeanShell does not support the new-style for loops Try the code in command-line BeanShell
On 7 September 2015 at 11:08, SanderW <[email protected]> wrote: > Hi, > > I'm using a BeanShell PostProcessor for parsing a JSON response. > For that I'm using Ralf Sternberg’s slim JSON parser for Java > (http://eclipsesource.com/blogs/2013/04/18/minimal-json-parser-for-java/) > > When using a for-loop I get an error "Can't iterate over type: class > com.eclipsesource.json.JsonArray". > Ralf asks me for a stacktrace, so I've added a try-catch, but I don't seem > to get the stacktrace anywhere. > > How do I get a stacktrace for this error? > > /try { > for (JsonValue member : members) log.info("firstName: " + firstName); > } > catch (Throwable ex) { > log.error("Failed to do this or that", ex); > }/ > > jmeter.log: > 2015/09/07 12:07:50 ERROR - jmeter.util.BeanShellInterpreter: Error invoking > bsh method: eval Sourced file: inline evaluation of: ``import > com.eclipsesource.json.*; String jsonString = prev.getResponseDataAsStri . > . . '' : Can't iterate over type: class com.eclipsesource.json.JsonArray > 2015/09/07 12:07:50 WARN - jmeter.protocol.java.sampler.BeanShellSampler: > org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval > Sourced file: inline evaluation of: ``import com.eclipsesource.json.*; > String jsonString = prev.getResponseDataAsStri . . . '' : Can't iterate over > type: class com.eclipsesource.json.JsonArray > > > > > -- > View this message in context: > http://jmeter.512774.n5.nabble.com/Getting-stacktrace-for-org-apache-jorphan-util-JMeterException-tp5723175.html > Sent from the JMeter - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
