String jemterHome = "D:\\program files\\apache-jmeter-5.1.1";
String jmxFile = "D:\\jmeterFile\\1.jmx";
JMeterUtils.setJMeterHome(jemterHome);
JMeterUtils.loadJMeterProperties(JMeterUtils.getJMeterBinDir() + "/jmeter.properties");
HashTree hashTree = SaveService.loadTree(new File(jmxFile));
StandardJMeterEngine jMeterEngine = new StandardJMeterEngine();
jMeterEngine.configure(hashTree);
jMeterEngine.run();
运行到 jMeterEngine.run();这一步内部报错。
报错信息
ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
java.lang.Throwable: Could not access D:\java_project\lib
at org.apache.jmeter.NewDriver.(NewDriver.java:105)
at org.apache.jmeter.testelement.TestPlan.testStarted(TestPlan.java:266)
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:206)
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:381)
at com.chenxi.test.JmeterConfigFile.main(JmeterConfigFile.java:172)
java.lang.Throwable: Could not access D:\java_project\lib\ext
at org.apache.jmeter.NewDriver.(NewDriver.java:105)
at org.apache.jmeter.testelement.TestPlan.testStarted(TestPlan.java:266)
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:206)
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:381)
at com.chenxi.test.JmeterConfigFile.main(JmeterConfigFile.java:172)
java.lang.Throwable: Could not access D:\java_project\lib\junit
at org.apache.jmeter.NewDriver.(NewDriver.java:105)
at org.apache.jmeter.testelement.TestPlan.testStarted(TestPlan.java:266)
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:206)
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:381)
at com.chenxi.test.JmeterConfigFile.main(JmeterConfigFile.java:172)
我的问题是,为啥要访问 D:\java_project\lib??
classpath 路径?
备注:1.jmx 通过 gui 启动是正常的。
2.maven 项目的目录是 D:\java_project\mp1