JMeter exception 'Error in method invocation'

Hi All, I am new to JMeter and trying to do a relatively simple task in a Beanshell Sampler.
I have a loop that is going to evaluate a variable 'Size' and I want the loop to break off when Size is 0. In a Rest call, I execute an XPath query to extract values and they are returned to a variable QSize_<x>.
In my Beanshell, I want to evaluate all QSize variables, when any one of these variables is not 0, I will assign it to Size then break out of the for loop in the beanshell. If all are 0, then I want to set Size to 0 to break the While loop. Below is my script:
import org.apache.jmeter.util.JMeterUtils;
boolean foundValue=false;
for(int i=0;i<${QSize_matchNr};i++)
{      
     String test=JMeterUtils.getProperty("QSize_"+ i,"-1");
      if (new Integer(test).intValue() > 0)
      {
          print("**********Size at index " + i + " is " + test);
          JMeterUtils.setProperty("Size", test);
          foundValue = true;
         break;
      }
}

if (!foundValue)
    JMeterUtils.setProperty("Size", "0");


I am getting the following error:

2015/05/05 09:46:56 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval      Sourced file: inline evaluation of: ``import org.apache.jmeter.util.JMeterUtils; boolean foundValue=false; for(int i=0 . . . '' : Typed variable declaration : Error in method invocation: Static method getProperty( java.lang.String, java.lang.String ) not found in class'org.apache.jmeter.util.JMeterUtils'

Attached is my JMeter spec file, change the extention to jmx ActiveMQ.txt
atxmanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BullockQA EngineerCommented:
The JMeterUtils class has a getProperty method which takes one String as a parameter.
Your code passes two String parameters.

Here's the documentation for the class.
https://jmeter.apache.org/api/org/apache/jmeter/util/JMeterUtils.html

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
atxmanAuthor Commented:
Thank you for that comment, I did make the change so that the extra string was removed, however I still get the following error message:
jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval      Sourced file: inline evaluation of: ``import org.apache.jmeter.util.JMeterUtils; boolean foundValue=false; count = new . . . '' : Object constructor
Mark BullockQA EngineerCommented:
Please post the latest version of your code.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

atxmanAuthor Commented:
import org.apache.jmeter.util.JMeterUtils;
boolean foundValue=false;
for(int i=0;i<${QSize_matchNr};i++)
{      
     String test=JMeterUtils.getProperty("QSize_"+ i);
      if (new Integer(test).intValue() > 0)
      {
          print("**********Size at index " + i + " is " + test);
          JMeterUtils.setProperty("Size", test);
          foundValue = true;
         break;
      }
}

if (!foundValue)
    JMeterUtils.setProperty("Size", "0");
Mark BullockQA EngineerCommented:
I'm sorry I can't match the error message with your code.
The error message has "count = new ", but I don't see that in your code.
atxmanAuthor Commented:
thanks for  the feedbsck
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.