如果我将脚本运行为
./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 jar 和 jmeter extra libs jar