1
votes

If I run the script as

./jmeter.sh -n -t test_load.jmx from apache-jmeter-3.0/bin 

it works fine, whereas when I run the same script from Maven, I get this error:

[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

This is line number 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>

Added pom.xml, screenshot of the lib folder and lib/ext folder. Manually added the apache jmeter 3.0 core jar, along with it the json jars and the jmeter extra libs jar as well

Also attaching the screenshot of my lib & lib/ext folder Screenshot_lib/ext

Jmeter project with version apache jmeter 2.13Json Postprocessor error on apache 2.13 with extra libs added in the /lib/ext

/lib/ext folder

1
Are you following these steps blog.codecentric.de/en/2014/01/…Vikas Madhusudana
@VikasMadhusudana I get this error only when the Json post processor is used in the sample request. Json Post processor is part of apache 3.0 jmeter. Not sure why it wont work on maven 4.0.Rajul
Can you show your Maven configuration ? pom.xml ?UBIK LOAD PACK
@UBIKLOADPACK Added the pom.xml for your reference.Rajul

1 Answers

2
votes

You're most probably using a 2.13 version of JMeter instead of a 3.0 through the dependencies management used by jmeter-maven-plugin.

You're also using a 3rd party plugin that you need to add to maven pom.xml.

Note that jmeter-maven-plugin-1.10.1 does not support JMeter 3.0.

The support for JMeter 3.0 has been officially released in version 2.X as per:

So you should upgrade to last version of jmeter-maven-plugin and follow this documentation using as dependency:

kg.apc:jmeter-plugins-json:2.6

But sinc JMeter 3.0, JSON extraction is supported OOTB by JMeter core so you wouldn't need any plugin.