如果我运行脚本为
./jmeter.sh -n -t test_load.jmx from apache-jmeter-3.0/bin
它运行正常,而当我从Maven运行相同的脚本时,我收到此错误:
[debug] ------------------------------- : JSONPostProcessor : JSONPostProcessor
[debug] ---- Debugging information ----
[debug] message : JSONPostProcessor
[debug] cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
[debug] cause-message : JSONPostProcessor
[debug] class : org.apache.jorphan.collections.ListedHashTree
[debug] required-type : org.apache.jorphan.collections.ListedHashTree
[debug] converter-type : org.apache.jmeter.save.converters.HashTreeConverter
[debug] path : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[7]/hashTree/hashTree[2]/JSONPostProcessor
[debug] line number : 160
这是第160行:
<JSONPostProcessor guiclass="JSONPostProcessorGui" testclass="JSONPostProcessor" testname="JSON Path PostProcessor-UserId" enabled="true">
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rajulonline.com</groupId>
<artifactId>jmeter-demo</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>jmeter-demo</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.10.1</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
添加了pom.xml,lib文件夹和lib / ext文件夹的屏幕截图。手动添加了apache jmeter 3.0核心jar,以及json jars和jmeter extra libs jar以及它
您最有可能通过jmeter-maven-plugin使用的依赖关系管理使用2.13版本的JMeter而不是3.0。
您还使用了需要添加到maven pom.xml的第三方插件。
请注意,jmeter-maven-plugin-1.10.1不支持JMeter 3.0。
对JMeter 3.0的支持已在版本2.X中正式发布,具体如下:
所以你应该升级到jmeter-maven-plugin的最后一个版本,并使用as依赖这个documentation:
kg.apc:JMeter的-插件,JSON:2.6
但是sinc JMeter 3.0,JMe提取由JMeter核心支持OOTB,所以你不需要任何插件。