我正在尝试执行具有HTTP Cookie管理器的JMeter测试计划。该测试计划在独立的JMeter中成功运行,但是在尝试使用JMeter maven插件运行时失败。 我在jmx上收到以下错误。日志文件。
ERROR o.a.j.p.h.c.CookieManager: Unable to load or invoke class: org.apache.jmeter.protocol.http.control.HC3CookieHandler
org.apache.jorphan.util.JMeterException: java.lang.ClassNotFoundException: org.apache.jmeter.protocol.http.control.HC3CookieHandler
at org.apache.jorphan.reflect.ClassTools.construct(ClassTools.java:92) ~[jorphan-3.2.jar:3.2 r1790748]
at org.apache.jmeter.protocol.http.control.CookieManager.testStarted(CookieManager.java:415) [ApacheJMeter_http-3.2.jar:3.2 r1790748]
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:218) [ApacheJMeter_core-3.2.jar:3.2 r1790748]
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:388) [ApacheJMeter_core-3.2.jar:3.2 r1790748]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]
Caused by: java.lang.ClassNotFoundException: org.apache.jmeter.protocol.http.control.HC3CookieHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_172]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_172]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_172]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_172]
at java.lang.Class.forName(Class.java:264) ~[?:1.8.0_172]
at org.apache.jorphan.reflect.ClassTools.construct(ClassTools.java:86) ~[jorphan-3.2.jar:3.2 r1790748]
... 4 more
当我从测试计划中删除HTTP Cookie Manager采样器时,不会发生上述错误。感谢所有解决此问题的线索。
POM配置如下所示
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.7.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
<goal>results</goal>
</goals>
</execution>
</executions>
<configuration>
<jmeterVersion>4.0</jmeterVersion>
<jmeterExtensions>
</jmeterExtensions>
<propertiesUser>
</propertiesUser>
<downloadExtensionDependencies>false</downloadExtensionDependencies>
<propertiesFilesDirectory>${basedir}/src/test/resources</propertiesFilesDirectory>
<testFilesDirectory>${basedir}/src/test/jmeter</testFilesDirectory>
</configuration>
</plugin>
</plugins>
</build>
答案 0 :(得分:1)
HTTP Cookie管理器实施框已删除
我希望您现有的测试计划的“实施”(Implementation)下拉列表中有HC3CookieHandler
,它与JMeter 4.0不兼容,后者是jmeter-maven-plugin 2.7.0的传递依赖项
建议的解决方法是: