在 JMeter 中创建 Hashtable table 生成语法错误
Creation of Hashtable table in JMeter generating syntax error
我需要一些帮助来理解为什么我不能在 JMeter 中创建 Hashtable 对象。
这是我的代码:
import java.util.Hashtable;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQQueue;
import com.ibm.mq.constants.MQConstants;
Hashtable mqProps = new Hashtable<String, Object>();
mqProps.put(MQConstants.CHANNEL_PROPERTY, "my_channel");
mqProps.put(MQConstants.PORT_PROPERTY, my_port);
mqProps.put(MQConstants.HOST_NAME_PROPERTY, "my_host");
mqProps.put(MQConstants.USER_ID_PROPERTY, "my_user_id");
mqProps.put(MQConstants.PASSWORD_PROPERTY, "my_password");
MQQueueManager qMgr = new MQQueueManager("my_QM", mqProps);
vars.putObject("QMGR", qMgr);
请查看我遇到的以下错误消息:
ERROR o.a.j.p.j.s.JSR223Sampler: Problem in JSR223 script Create QueueManager, message: javax.script.ScriptException: In file: inline evaluation of: ``import java.util.Hashtable; import com.ibm.mq.MQQueueManager; import com.ibm.mq. . . . '' Encountered "<" at line 7, column 34.
in inline evaluation of: ``import java.util.Hashtable; import com.ibm.mq.MQQueueManager; import com.ibm.mq. . . . '' at line number 7
javax.script.ScriptException: In file: inline evaluation of: ``import java.util.Hashtable; import com.ibm.mq.MQQueueManager; import com.ibm.mq. . . . '' Encountered "<" at line 7, column 34.
in inline evaluation of: ``import java.util.Hashtable; import com.ibm.mq.MQQueueManager; import com.ibm.mq. . . . '' at line number 7
你知道为什么 JMeter 不支持 <
字符吗?
请注意,语言设置为 java
。
非常感谢,
Note that Language is set as java.
它不是 Java,它是 Beanshell which doesn't support diamond operators 所以选项在:
- 要么删除它们,即
Hashtable mqProps = new Hashtable();
- 或(更好)切换到
groovy
为 it's recommended scripting option since JMeter 3.1 mainly because it provides better performance than any other language
我需要一些帮助来理解为什么我不能在 JMeter 中创建 Hashtable 对象。
这是我的代码:
import java.util.Hashtable;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQQueue;
import com.ibm.mq.constants.MQConstants;
Hashtable mqProps = new Hashtable<String, Object>();
mqProps.put(MQConstants.CHANNEL_PROPERTY, "my_channel");
mqProps.put(MQConstants.PORT_PROPERTY, my_port);
mqProps.put(MQConstants.HOST_NAME_PROPERTY, "my_host");
mqProps.put(MQConstants.USER_ID_PROPERTY, "my_user_id");
mqProps.put(MQConstants.PASSWORD_PROPERTY, "my_password");
MQQueueManager qMgr = new MQQueueManager("my_QM", mqProps);
vars.putObject("QMGR", qMgr);
请查看我遇到的以下错误消息:
ERROR o.a.j.p.j.s.JSR223Sampler: Problem in JSR223 script Create QueueManager, message: javax.script.ScriptException: In file: inline evaluation of: ``import java.util.Hashtable; import com.ibm.mq.MQQueueManager; import com.ibm.mq. . . . '' Encountered "<" at line 7, column 34.
in inline evaluation of: ``import java.util.Hashtable; import com.ibm.mq.MQQueueManager; import com.ibm.mq. . . . '' at line number 7
javax.script.ScriptException: In file: inline evaluation of: ``import java.util.Hashtable; import com.ibm.mq.MQQueueManager; import com.ibm.mq. . . . '' Encountered "<" at line 7, column 34.
in inline evaluation of: ``import java.util.Hashtable; import com.ibm.mq.MQQueueManager; import com.ibm.mq. . . . '' at line number 7
你知道为什么 JMeter 不支持 <
字符吗?
请注意,语言设置为 java
。
非常感谢,
Note that Language is set as java.
它不是 Java,它是 Beanshell which doesn't support diamond operators 所以选项在:
- 要么删除它们,即
Hashtable mqProps = new Hashtable();
- 或(更好)切换到
groovy
为 it's recommended scripting option since JMeter 3.1 mainly because it provides better performance than any other language