简体   繁体   English

JMeter:如何在不将其放入jmeter / lib / ext的jar中的情况下测试AbstractJavaSamplerClient

[英]JMeter: How to test an AbstractJavaSamplerClient without putting it into a jar in jmeter/lib/ext

I have a jmeter AbstractJavaSamplerClient and want to test it without packing it into a jar in /jmeter/lib or jmeter]/lib/ext because this is very inconvenient. 我有一个jmeter AbstractJavaSamplerClient并且想要测试它而不将其包装到/jmeter/libjmeter]/lib/ext的jar中,因为这非常不方便。 I tried the following options but none succeeded: 我尝试了以下选项,但没有成功:

  • start jmeter with custom classpath using java.exe -classpath (jmeter starts but does not see my AbstractJavaSamplerClient); 使用java.exe -classpath使用自定义类路径启动jmeter(jmeter启动但看不到我的AbstractJavaSamplerClient);
  • modified user.classpath in jmeter.properties (does not seem to have any effect); 在jmeter.properties中修改了user.classpath(似乎没有任何作用);
  • modified search_paths in jmeter.properties (does not seem to have any effect). 在jmeter.properties中修改了search_paths(似乎没有任何作用)。

I'm using jmeter 2.9, thanx. 我正在使用jmeter 2.9,thanx。

JMeter automatically finds classes from jars in the following directories: JMETER_HOME/lib - used for utility jars JMETER_HOME/lib/ext - used for JMeter components and plugins If you have developed new JMeter components, then you should jar them and copy the jar into JMeter's lib/ext directory. JMeter会自动从以下目录中的jar中查找类:JMETER_HOME / lib-用于实用程序jars JMETER_HOME / lib / ext-用于JMeter组件和插件如果开发了新的JMeter组件,则应将它们打包,并将该jar复制到JMeter的lib / ext目录。 JMeter will automatically find JMeter components in any jars found here. JMeter将在此处找到的任何jar中自动找到JMeter组件。 Do not use lib/ext for utility jars or dependency jars used by the plugins; 不要将lib / ext用于插件使用的实用程序jar或依赖项jar; it is only intended for JMeter components and plugins. 它仅适用于JMeter组件和插件。

If you don't want to put JMeter plugin jars in the lib/ext directory, then define the property search_paths in jmeter.properties. 如果您不想将JMeter插件jar放在lib / ext目录中,请在jmeter.properties中定义属性search_paths。

Utility and dependency jars (libraries etc) can be placed in the lib directory. 实用程序和依赖项jar(库等)可以放在lib目录中。

If you don't want to put such jars in the lib directory, then define the property user.classpath or plugin_dependency_paths in jmeter.properties. 如果您不想将这样的jar放在lib目录中,请在jmeter.properties中定义属性user.classpath或plugin_dependency_paths。 See below for an explanation of the differences. 有关差异的说明,请参见下文。

Other jars (such as JDBC, JMS implementations and any other support libaries needed by the JMeter code) should be placed in the lib directory - not the lib/ext directory, or added to user.classpath . 其他jar(例如JDBC,JMS实现和JMeter代码所需的任何其他支持库)应放在lib目录中-而不是lib / ext目录中,或添加到user.classpath中。

Note: JMeter will only find .jar files, not .zip. 注意:JMeter将仅查找.jar文件,而不查找.zip。

You can also install utility Jar files in $JAVA_HOME/jre/lib/ext, or you can set the property user.classpath in jmeter.properties 您也可以在$ JAVA_HOME / jre / lib / ext中安装实用程序Jar文件,或者可以在jmeter.properties中设置属性user.classpath。

Note that setting the CLASSPATH environment variable will have no effect. 请注意,设置CLASSPATH环境变量将无效。 This is because JMeter is started with "java -jar", and the java command silently ignores the CLASSPATH variable, and the -classpath/-cp options when -jar is used. 这是因为JMeter以“ java -jar”启动,并且当使用-jar时,java命令会静默忽略CLASSPATH变量和-classpath / -cp选项。 [This occurs with all Java programs, not just JMeter.] [这发生在所有Java程序中,而不仅仅是JMeter。]

Putting it in a folder referenced by the following property works: 将其放在以下属性引用的文件夹中即可:

  • search_paths search_paths

You should check that your JAR is fine and that you put all your dependencies in jmeter/lib folder. 您应该检查JAR是否正常,并将所有依赖项放在jmeter / lib文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM