I'm trying to execute the JMeter test which the following command. https://www.blazemeter.com/blog/5-ways-launch-jmeter-test-without-using-jmeter-gui
public static void main(String[] argv) throws Exception {
// JMeter Engine
StandardJMeterEngine jmeter = new StandardJMeterEngine();
// Initialize Properties, logging, locale, etc.
JMeterUtils.loadJMeterProperties("/work/apache-jmeter-5.0/bin/jmeter.properties");
JMeterUtils.setJMeterHome("/work/apache-jmeter-5.0");
//JMeterUtils.initLogging();// you can comment this line out to see extra log messages of i.e. DEBUG level
JMeterUtils.initLocale();
// Initialize JMeter SaveService
SaveService.loadProperties();
// Load existing .jmx Test Plan
File in = new File("/work/apache-jmeter-5.0/extras/jmeter_test.jmx");
HashTree testPlanTree = SaveService.loadTree(in);
//in.close();
// Run JMeter Test
jmeter.configure(testPlanTree);
jmeter.run();
}
But I always get an error
Caused by : com.thoughtworks.xstream.converters.ConversionException Could you please help me!
And below is detail error:
Exception in thread "main" java.lang.IllegalArgumentException: Problem loading XML from:'/work/apache-jmeter-5.0/extras/jmeter_test.jmx'.
Cause:
CannotResolveClassException: org.apache.jmeter.protocol.http.control.CookieManager
cause-exception :
at org.apache.jmeter.save.ScriptWrapperConverter.createConversionException(ScriptWrapperConverter.java:102)
at org.apache.jmeter.save.ScriptWrapperConverter.unmarshal(ScriptWrapperConverter.java:96)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1486)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1466)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1337)
at org.apache.jmeter.save.SaveService.readTree(SaveService.java:452)
Possible solution described here : https://sqa.stackexchange.com/questions/24441/xml-loading-issue-with-jmx-generated-by-blazemeter-mobile-recorder
or here : Jmeter Error in non GUI mode
Either your JMeter installation is corrupt or your Java project configuration is incorrect.
Make sure that this file is present:
/work/apache-jmeter-5.0/lib/ext/ApacheJMeter_http.jar
If it is - add it to your Java project Classpath:
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.