Java 无法初始化类org.apache.jmeter.protocol.http.proxy.ProxyControl

Java 无法初始化类org.apache.jmeter.protocol.http.proxy.ProxyControl,java,jmeter,Java,Jmeter,您好,我正在尝试在IntelliJ中运行java代码,并尝试初始化ApacheJMeter,但显示了以下错误。。。有人能解释一下可能的错误吗? Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jmeter.protocol.http.proxy.ProxyControl at jdk.internal.reflect.GeneratedConstructorAccessor

您好,我正在尝试在IntelliJ中运行java代码,并尝试初始化ApacheJMeter,但显示了以下错误。。。有人能解释一下可能的错误吗?

 Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jmeter.protocol.http.proxy.ProxyControl
    at jdk.internal.reflect.GeneratedConstructorAccessor8.newInstance(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at java.base/java.lang.Class.newInstance(Class.java:584)
    at org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:100)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readBareItem(AbstractCollectionConverter.java:132)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:117)
    at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readBareItem(AbstractCollectionConverter.java:132)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:117)
    at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at org.apache.jmeter.save.ScriptWrapperConverter.unmarshal(ScriptWrapperConverter.java:95)
    ... 22 more
java.lang.IllegalArgumentException: Problem loading XML from:'C:\Users\IEUser\Desktop\apache-jmeter-3.1\bin\transactions\PetStore\all_transactions_local_server.jmx', missing class com.thoughtworks.xstream.converters.ConversionException: 
---- Debugging information ----
cause-exception     : java.lang.NoClassDefFoundError
cause-message       : Could not initialize class org.apache.jmeter.protocol.http.proxy.ProxyControl
first-jmeter-class  : org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:100)
class               : org.apache.jmeter.save.ScriptWrapper
required-type       : org.apache.jmeter.save.ScriptWrapper
converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
path                : /jmeterTestPlan/hashTree/hashTree/ProxyControl
line number         : 15
version             : 3.1 r1770033
根据描述:

如果Java虚拟机或ClassLoader实例尝试加载类的定义(作为普通方法调用的一部分或使用新表达式创建新实例的一部分),但找不到该类的定义,则引发

编译当前执行的类时,已存在搜索的类定义,但无法再找到该定义

您至少需要有:

  • JMeter的“lib”文件夹中的所有内容
  • JMeter的“lib/ext”文件夹中的所有内容
  • 在您的应用程序中,一旦完成,您将能够运行代码


    您还可能发现示例项目非常有用/有趣

    请尝试使用较新的jmererversion@user7294900同样的事情也发生在5.4.1版本中