Jmeter5.0源码导入idea
1、下载Jmeter源码包与二进制包
下载参考:https://www.cnblogs.com/ychun/p/15324797.html
教程所用:Jmeter5.0源码与二进制包
解压后
2、导入idea
3、导入jar包
1)选择JDK
2)sources设置,将SRC下的 各个org的父文件夹添加为Sources
比如:
3) 移除本身的jar导入二进制包里面的jar
导入,选择二进制压缩包 lib
应用
4、错误修改
1)缺少jar
解决
下载添加jar
地址:https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
导入jar(添加-勾选-应用)
5、尝试运行
ctrl+N 寻找 NewDriver.java , 并run
6、再次报错后解决
D:\02tools\java\bin\java.exe "-javaagent:D:\02tools\IntelliJ IDEA 2020.2.2\lib\idea_rt.jar=61815:D:\02tools\IntelliJ IDEA 2020.2.2\bin" -Dfile.encoding=UTF-8 -classpath D:\02tools\java\jre\lib\charsets.jar;D:\02tools\java\jre\lib\deploy.jar;D:\02tools\java\jre\lib\ext\access-bridge-64.jar;D:\02tools\java\jre\lib\ext\cldrdata.jar;D:\02tools\java\jre\lib\ext\dnsns.jar;D:\02tools\java\jre\lib\ext\jaccess.jar;D:\02tools\java\jre\lib\ext\jfxrt.jar;D:\02tools\java\jre\lib\ext\localedata.jar;D:\02tools\java\jre\lib\ext\nashorn.jar;D:\02tools\java\jre\lib\ext\sunec.jar;D:\02tools\java\jre\lib\ext\sunjce_provider.jar;D:\02tools\java\jre\lib\ext\sunmscapi.jar;D:\02tools\java\jre\lib\ext\sunpkcs11.jar;D:\02tools\java\jre\lib\ext\zipfs.jar;D:\02tools\java\jre\lib\javaws.jar;D:\02tools\java\jre\lib\jce.jar;D:\02tools\java\jre\lib\jfr.jar;D:\02tools\java\jre\lib\jfxswt.jar;D:\02tools\java\jre\lib\jsse.jar;D:\02tools\java\jre\lib\management-agent.jar;D:\02tools\java\jre\lib\plugin.jar;D:\02tools\java\jre\lib\resources.jar;D:\02tools\java\jre\lib\rt.jar;D:\repository\source\test\apache-jmeter-5.0\classes\production\apache-jmeter-5.0_2;D:\repository\source\test\apache-jmeter_binary\lib\asm-6.1.jar;D:\repository\source\test\apache-jmeter_binary\lib\darcula.jar;D:\repository\source\test\apache-jmeter_binary\lib\jorphan.jar;D:\repository\source\test\apache-jmeter_binary\lib\bsf-2.4.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\bsh-2.0b6.jar;D:\repository\source\test\apache-jmeter_binary\lib\bshclient.jar;D:\repository\source\test\apache-jmeter_binary\lib\dec-0.1.2.jar;D:\repository\source\test\apache-jmeter_binary\lib\oro-2.0.8.jar;D:\repository\source\test\apache-jmeter_binary\lib\jtidy-r938.jar;D:\repository\source\test\apache-jmeter_binary\lib\junit-4.12.jar;D:\repository\source\test\apache-jmeter_binary\lib\xalan-2.7.2.jar;D:\repository\source\test\apache-jmeter_binary\lib\jsoup-1.11.2.jar;D:\repository\source\test\apache-jmeter_binary\lib\ph-css-6.1.1.jar;D:\repository\source\test\apache-jmeter_binary\lib\rhino-1.7.10.jar;D:\repository\source\test\apache-jmeter_binary\lib\dnsjava-2.1.8.jar;D:\repository\source\test\apache-jmeter_binary\lib\jcharts-0.7.5.jar;D:\repository\source\test\apache-jmeter_binary\lib\caffeine-2.6.2.jar;D:\repository\source\test\apache-jmeter_binary\lib\commons-io-2.6.jar;D:\repository\source\test\apache-jmeter_binary\lib\httpmime-4.5.6.jar;D:\repository\source\test\apache-jmeter_binary\lib\jodd-log-4.1.4.jar;D:\repository\source\test\apache-jmeter_binary\lib\json-smart-2.3.jar;D:\repository\source\test\apache-jmeter_binary\lib\mail-1.5.0-b01.jar;D:\repository\source\test\apache-jmeter_binary\lib\tika-core-1.18.jar;D:\repository\source\test\apache-jmeter_binary\lib\xstream-1.4.10.jar;D:\repository\source\test\apache-jmeter_binary\lib\commons-net-3.6.jar;D:\repository\source\test\apache-jmeter_binary\lib\httpcore-4.4.10.jar;D:\repository\source\test\apache-jmeter_binary\lib\jodd-core-4.1.4.jar;D:\repository\source\test\apache-jmeter_binary\lib\json-path-2.4.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\xml-apis-1.4.01.jar;D:\repository\source\test\apache-jmeter_binary\lib\xmlpull-1.1.3.1.jar;D:\repository\source\test\apache-jmeter_binary\lib\xpp3_min-1.1.4c.jar;D:\repository\source\test\apache-jmeter_binary\lib\httpclient-4.5.6.jar;D:\repository\source\test\apache-jmeter_binary\lib\jodd-props-4.1.4.jar;D:\repository\source\test\apache-jmeter_binary\lib\log4j-api-2.11.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\ph-commons-9.1.2.jar;D:\repository\source\test\apache-jmeter_binary\lib\serializer-2.7.2.jar;D:\repository\source\test\apache-jmeter_binary\lib\slf4j-api-1.7.25.jar;D:\repository\source\test\apache-jmeter_binary\lib\slf4j-ext-1.7.25.jar;D:\repository\source\test\apache-jmeter_binary\lib\commons-jexl3-3.1.jar;D:\repository\source\test\apache-jmeter_binary\lib\commons-lang3-3.8.jar;D:\repository\source\test\apache-jmeter_binary\lib\freemarker-2.3.28.jar;D:\repository\source\test\apache-jmeter_binary\lib\groovy-all-2.4.15.jar;D:\repository\source\test\apache-jmeter_binary\lib\hamcrest-core-1.3.jar;D:\repository\source\test\apache-jmeter_binary\lib\log4j-core-2.11.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\Saxon-HE-9.8.0-12.jar;D:\repository\source\test\apache-jmeter_binary\lib\tika-parsers-1.18.jar;D:\repository\source\test\apache-jmeter_binary\lib\xercesImpl-2.11.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\commons-codec-1.11.jar;D:\repository\source\test\apache-jmeter_binary\lib\commons-jexl-2.1.1.jar;D:\repository\source\test\apache-jmeter_binary\lib\jodd-lagarto-4.1.4.jar;D:\repository\source\test\apache-jmeter_binary\lib\accessors-smart-1.2.jar;D:\repository\source\test\apache-jmeter_binary\lib\commons-dbcp2-2.4.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\commons-math3-3.6.1.jar;D:\repository\source\test\apache-jmeter_binary\lib\commons-pool2-2.6.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\hamcrest-date-2.0.4.jar;D:\repository\source\test\apache-jmeter_binary\lib\httpcore-nio-4.4.10.jar;D:\repository\source\test\apache-jmeter_binary\lib\log4j-1.2-api-2.11.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\httpasyncclient-4.1.3.jar;D:\repository\source\test\apache-jmeter_binary\lib\jcl-over-slf4j-1.7.25.jar;D:\repository\source\test\apache-jmeter_binary\lib\rsyntaxtextarea-2.6.1.jar;D:\repository\source\test\apache-jmeter_binary\lib\javax.activation-1.2.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\log4j-slf4j-impl-2.11.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\xmlgraphics-commons-2.2.jar;D:\repository\source\test\apache-jmeter_binary\lib\mongo-java-driver-2.11.3.jar;D:\repository\source\test\apache-jmeter_binary\lib\commons-collections-3.2.2.jar;D:\repository\source\test\apache-jmeter_binary\lib\javax.activation-api-1.2.0.jar;D:\repository\source\test\apache-jmeter_binary\lib\geronimo-jms_1.1_spec-1.1.1.jar;C:\Users\liyujiao\Desktop\bcutil-jdk15on-1.69.jar;C:\Users\liyujiao\Desktop\bcpkix-jdk15on-1.69.jar;C:\Users\liyujiao\Desktop\bcprov-ext-jdk15on-1.69.jar;C:\Users\liyujiao\Desktop\bcmail-jdk15on-1.69.jar org.apache.jmeter.NewDriver java.lang.Throwable: Could not access D:\repository\source\test\lib at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:102) java.lang.Throwable: Could not access D:\repository\source\test\lib\ext at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:102) java.lang.Throwable: Could not access D:\repository\source\test\lib\junit at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:102) ERROR StatusLogger Unable to access file:/D:/repository/source/test/bin/log4j2.xml java.io.FileNotFoundException: D:\repository\source\test\bin\log4j2.xml (系统找不到指定的路径。) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at java.io.FileInputStream.<init>(FileInputStream.java:93) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188) at java.net.URL.openStream(URL.java:1045) at org.apache.logging.log4j.core.config.ConfigurationSource.fromUri(ConfigurationSource.java:247) at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:404) at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:346) at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:260) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:615) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636) at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:121) at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43) at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383) at org.apache.jmeter.JMeter.<clinit>(JMeter.java:122) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at java.lang.Class.newInstance(Class.java:442) at org.apache.jmeter.NewDriver.main(NewDriver.java:243) ERROR StatusLogger Reconfiguration failed: No configuration found for '18b4aac2' at 'null' in 'null' 15:06:51.316 [main] ERROR org.apache.jmeter.JMeter - An error occurred: java.lang.RuntimeException: Could not read JMeter properties file:D:\repository\source\test\bin\jmeter.properties at org.apache.jmeter.util.JMeterUtils.loadJMeterProperties(JMeterUtils.java:209) ~[apache-jmeter-5.0_2/:?] at org.apache.jmeter.JMeter.initializeProperties(JMeter.java:771) ~[apache-jmeter-5.0_2/:?] at org.apache.jmeter.JMeter.start(JMeter.java:453) [apache-jmeter-5.0_2/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161] at org.apache.jmeter.NewDriver.main(NewDriver.java:245) [apache-jmeter-5.0_2/:?] An error occurred: Could not read JMeter properties file:D:\repository\source\test\bin\jmeter.properties Process finished with exit code 1
修改 NewDriver.java
tmpDir = userDir.getAbsolutePath();
6、再次运行
成功
注意:
不要使用GUI模式进行加载测试!,仅用于测试创建和测试调试。对于负载测试,请使用NONGUI模式:jmemer-jmx文件[结果文件[Web报告文件夹路径]
我的ANT gradle版本