在Jmeter中解析props.get to int会给出;在类';java.lang.Integer'&引用;

在Jmeter中解析props.get to int会给出;在类';java.lang.Integer'&引用;,jmeter,Jmeter,我试图做一些应该相对简单的事情,但我不确定我遗漏了什么 我需要将属性中的值存储为整数。我正试着这么做 代码: 输出: 2016/10/12 17:11:22 INFO - jmeter.util.BeanShellTestElement: >>>>>>>>>>>>>>>>>13 2016/10/12 17:11:22 ERROR - jmeter.util.BeanShellInterpre

我试图做一些应该相对简单的事情,但我不确定我遗漏了什么

我需要将属性中的值存储为整数。我正试着这么做

代码:

输出:

2016/10/12 17:11:22 INFO  - jmeter.util.BeanShellTestElement: >>>>>>>>>>>>>>>>>13 
2016/10/12 17:11:22 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval   Sourced file: inline evaluation of: ``import java.io.*; import java.util.*; import org.apache.jmeter.services.FileServ . . . '' : Typed variable declaration : Error in method invocation: Static method parseInt( java.lang.Integer ) not found in class'java.lang.Integer' 
2016/10/12 17:11:22 WARN  - jmeter.modifiers.BeanShellPreProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval    Sourced file: inline evaluation of: ``import java.io.*; import java.util.*; import org.apache.jmeter.services.FileServ . . . '' : Typed variable declaration : Error in method invocation: Static method parseInt( java.lang.Integer ) not found in class'java.lang.Integer' 
这是一个属性(而不是var),因为它是在另一个线程组中设置的。但这一行一直给我“静态方法parseInt not found…”。我只想在for循环中使用该值(本例中为13)。有人有什么想法吗?

只需替换:

int-total\u-no\u-of-backends\u-getting\u-targeted=Integer.parseInt(props.get(“total\u-no\u-of-backends\u-getting\u-targeted”)

作者:

int total\u no\u of theu backends\u getting\u targeted=props.get(“total\u no\u of theu backends\u getting\u targeted”)

这条消息告诉您:

在类“java.lang.Integer”中找不到静态方法parseInt(java.lang.Integer)


这意味着Integer.parseInt获取一个整数而不是字符串作为参数

错误消息说props.get(“total\u no\u of_backends\u getting\u targeted”)已返回一个整数。你认为它会返回什么?你的解决方案在我的家用电脑上运行得很好。但在我的工作电脑上,我给你的解决方案在我的家用电脑上运行得非常好。但在我的工作计算机上,我得到了以下错误:2016/10/13 10:07:02错误-jmeter.util.BeanShellInterpreter:调用bsh方法时出错:eval源文件:内联求值:``import java.io.*;导入java.util.*;导入org.apache.jmeter.services.FileServ…“”:类型化变量声明:方法调用错误:在类“java.lang.Integer”中找不到静态方法parseInt(java.lang.Integer),基于错误,我认为您的工作计算机中仍然使用旧版本
2016/10/12 17:11:22 INFO  - jmeter.util.BeanShellTestElement: >>>>>>>>>>>>>>>>>13 
2016/10/12 17:11:22 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval   Sourced file: inline evaluation of: ``import java.io.*; import java.util.*; import org.apache.jmeter.services.FileServ . . . '' : Typed variable declaration : Error in method invocation: Static method parseInt( java.lang.Integer ) not found in class'java.lang.Integer' 
2016/10/12 17:11:22 WARN  - jmeter.modifiers.BeanShellPreProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval    Sourced file: inline evaluation of: ``import java.io.*; import java.util.*; import org.apache.jmeter.services.FileServ . . . '' : Typed variable declaration : Error in method invocation: Static method parseInt( java.lang.Integer ) not found in class'java.lang.Integer'