Jmeter-NonGUIDriver java.lang.IllegalArgumentException中的错误 [英] Jmeter- Error in NonGUIDriver java.lang.IllegalArgumentException

查看:262
本文介绍了Jmeter-NonGUIDriver java.lang.IllegalArgumentException中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Maven项目执行.jmx(Jmeter). 在Jmeter 3.1版本中创建了jmx文件. 使用jmeter-maven-plugin 2.1.0. 使用-mvn clean verify在命令行中执行时出现以下错误

Trying to execute .jmx (Jmeter) using maven project. Created jmx file in Jmeter 3.1 version. Using jmeter-maven-plugin 2.1.0. Getting following error while executing in command line using - mvn clean verify

[INFO]  P E R F O R M A N C E    T E S T S
[INFO] -------------------------------------------------------
[INFO] Invalid value detected for <postTestPauseInSeconds>.  Setting pause to 0...
[INFO]
[INFO]
[INFO] Executing test: CCMTestPlan.jmx
[INFO] Writing log file to: E:\jmeter-mvn-master\jmeter-mvn-  master\target\jmeter\logs\CCMTestPlan.jmx.log
[INFO] Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'E:\jmeter-mvn-master\jmeter-mvn-master\target\jmeter\testFiles\CCMTestPlan.jmx', missing class com.thoughtworks.xstream.converters.ConversionException:
[INFO] ---- Debugging information ----
[INFO] cause-exception     : com.thoughtworks.xstream.converters.ConversionException
[INFO] cause-message       :
[INFO] first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
[INFO] class               : org.apache.jmeter.save.ScriptWrapper
[INFO] required-type       : org.apache.jorphan.collections.ListedHashTree
[INFO] converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
[INFO] path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[3]/com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor
[INFO] line number         : 98
[INFO] version             : 3.1 r1770033
[INFO] -------------------------------

以下是我的pom.xml文件

Following is my pom.xml file

<build>
    <plugins>
    <plugin>
        <groupId>com.lazerycode.jmeter</groupId>
        <artifactId>jmeter-maven-plugin</artifactId>
        <version>2.1.0</version>
        <configuration>
            <testResultsTimestamp>false</testResultsTimestamp>
            <jmeterPlugins>
                <plugin>
                   <groupId>kg.apc</groupId>
                   <artifactId>jmeter-plugins-extras-libs</artifactId>
                </plugin>
            </jmeterPlugins>   
            <testFilesIncluded>
                      <testFilesIncluded>CCMTestPlan.jmx</testFilesIncluded>
            </testFilesIncluded>   
            <jmeterVersion>3.1</jmeterVersion>         
        </configuration>
        <executions>
            <execution>
                <id>jmeter-tests</id>
                <phase>verify</phase>
                <goals>
                    <goal>jmeter</goal>
                </goals>                
            </execution>
        </executions>
        <dependencies>
            <dependency>
               <groupId>kg.apc</groupId>
               <artifactId>jmeter-plugins-extras-libs</artifactId>
               <version>1.3.1</version>
            </dependency>
        </dependencies>
    </plugin>
    </plugins>
</build>

有人遇到这个问题吗?

推荐答案

插件的2.x版本中的依赖项配置已更改(请参见 https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/将附加库添加到类路径中)

Dependency configuration has changed in the 2.x versions of the plugin (see https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Adding-additional-libraries-to-the-classpath)

将jar添加到/lib/ext目录

您可以将任何其他Java库添加到JMeter的lib/ext 使用<jmeterExtensions>配置元素访问目录. 这使用Eclipse Aether库执行依赖关系 分辨率.

Adding jar's to the /lib/ext directory

You can add any additional Java libraries to JMeter's lib/ext directory by using the <jmeterExtensions> configuration element. This uses the Eclipse Aether libraries to perform dependency resolution.

<project>
    [...]
        <build>
            <plugins>
                <plugin>
                    <groupId>com.lazerycode.jmeter</groupId>
                    <artifactId>jmeter-maven-plugin</artifactId>
                    <version>2.1.0</version>
                    <executions>
                        <execution>
                            <id>jmeter-tests</id>
                            <goals>
                                <goal>jmeter</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <jmeterExtensions>
                            <artifact>kg.apc:jmeter-plugins:pom:1.3.1</artifact>
                        </jmeterExtensions>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    [...]
</project>
+---+

当正确定义依赖项时,您可能会看到另一个错误,因为jmeter-plugins依赖于JMeter 2.13,它的maven依赖项树已损坏.这是jmeter-plugins团队需要修复的问题(他们需要发布依赖于JMeter 3.1的jmeter插件版本).

When you define your dependencies properly you will probably see another error because jmeter-plugins depends upon JMeter 2.13 which has a broken maven dependency tree. This is something the jmeter-plugins team needs to fix (they need to release a version of jmeter plugins that depends upon JMeter 3.1).

构建会中断,因为该插件正在尝试下载一些不存在的jmeter-plugin的可传递依赖项,您可以通过以下方法解决此问题:

The build will break because the plugin is trying to download some transitive dependencies for jmeter-plugins that don't exist, you can work around this by setting:

<downloadExtensionDependencies>false</downloadExtensionDependencies>

但这确实意味着您将需要在<jmeterExtensions>块中手动设置jmeter-plugins依赖的所有依赖项.

This does however mean that you will need to manually set all the dependencies that jmeter-plugins depends upon in your <jmeterExtensions> block.

您可以使用mvn dependency:tree获取jmeter-plugins-extras-libs软件包所需的依赖关系的完整列表.

You can use mvn dependency:tree to get the full list of dependencies required for the jmeter-plugins-extras-libs package.

以上信息尚未进入Wiki(正在执行添加该信息并将所有内容移至网站的任务),但是可以在CHANGELOG中找到它:

The above information hasn't made it into the Wiki yet (there's an ongoing task to add this information and move everything across to the website), it is however available in the CHANGELOG:

https://github.com /jmeter-maven-plugin/jmeter-maven-plugin/blob/master/CHANGELOG.md

这篇关于Jmeter-NonGUIDriver java.lang.IllegalArgumentException中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆