简体   繁体   中英

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. 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);
  • modified user.classpath in jmeter.properties (does not seem to have any effect);
  • modified search_paths in jmeter.properties (does not seem to have any effect).

I'm using 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 will automatically find JMeter components in any jars found here. Do not use lib/ext for utility jars or dependency jars used by the plugins; it is only intended for JMeter components and plugins.

If you don't want to put JMeter plugin jars in the lib/ext directory, then define the property search_paths in jmeter.properties.

Utility and dependency jars (libraries etc) can be placed in the lib directory.

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. 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 .

Note: JMeter will only find .jar files, not .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

Note that setting the CLASSPATH environment variable will have no effect. 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. [This occurs with all Java programs, not just JMeter.]

Putting it in a folder referenced by the following property works:

  • search_paths

You should check that your JAR is fine and that you put all your dependencies in jmeter/lib folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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