首页 > 解决方案 > 无法初始化类 org.apache.jmeter.protocol.http.parser.CssParser - JMeter

问题描述

我正在尝试在 Apache JMeter 5.2 上运行 LoadTest,当我尝试运行测试时,它显示了这个错误 =>

java.lang.NoClassDefFoundError: Could not initialize class org.apache.jmeter.protocol.http.parser.CssParser
    at java.lang.Class.forName0(Native Method) ~[?:?]
    at java.lang.Class.forName(Class.java:315) ~[?:?]
    at org.apache.jmeter.protocol.http.parser.BaseParser.getParser(BaseParser.java:66) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.getParser(HTTPSamplerBase.java:1481) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.downloadPageResources(HTTPSamplerBase.java:1332) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.resultProcessing(HTTPSamplerBase.java:1749) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.resultProcessing(HTTPAbstractImpl.java:556) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:648) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:67) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.downloadPageResources(HTTPSamplerBase.java:1417) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.resultProcessing(HTTPSamplerBase.java:1749) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.resultProcessing(HTTPAbstractImpl.java:556) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:648) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:67) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1282) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1271) ~[ApacheJMeter_http.jar:5.2]
    at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:627) ~[ApacheJMeter_core.jar:5.2]
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:551) ~[ApacheJMeter_core.jar:5.2]
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:490) ~[ApacheJMeter_core.jar:5.2]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257) ~[ApacheJMeter_core.jar:5.2]
    at java.lang.Thread.run(Thread.java:834) [?:?]

可能是什么原因?谢谢!

标签: javajmeterload-testing

解决方案


很可能您的 JMeter 安装以某种方式损坏,尝试使用JMeter 插件管理器jmeter - HTTP Protocol Support卸载组件,然后重新安装

在此处输入图像描述

它应该可以解决您的安装问题。


另请注意,根据 JMeter 最佳实践,您应该始终使用最新版本的 JMeter,因此鉴于您当前的 JMeter 安装已损坏,可能是升级到JMeter 5.3的好时机(或JMeter 下载页面上提供的最新稳定版本))


推荐阅读