Jmeter java协议测试jar和依赖jar的路径研究

本文分享了使用JMeter 2.12版本进行多机负载测试时遇到的问题及解决方案,强调了正确配置jar包路径的重要性,并提供了官方白皮书中关于JMeter组件和依赖项管理的具体指导。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

    昨天在使用2.12版本的jmeter时,执行多机负载测试一直报错,最终查明是使用不当的问题,现将详情记录如下,使用jmeter测试java协议脚本时要注意以下几点:

     1. jar包的方式路径一定是这样,否则可能会出现诡异问题:

      apache-jmeter

      -- lib                 —— 脚本依赖的包放在这里

     -- ext            —— 自己开发脚本(jar文件)放在这里

  2. jmeter/lib目录下本身有很多jar包,所以拷贝脚本依赖的jar时一定要小心,千万别和这些jmeter自带的重复,否则也会死的很难看!

附上官方白皮书:

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/extdirectory, 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.]

转载于:https://www.cnblogs.com/onmyway20xx/p/4260216.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值