NoClassDefFoundError while running .jmx command line using lazerycode jmeter plugin

  1. It is recommended to use latest versions of JMeter, its Maven plugin and JMeter Plugins so I would recommend amending your pom.xml like:

    <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
             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.example</groupId>
        <artifactId>mvn-jmeter</artifactId>
        <version>1.0-SNAPSHOT</version>
        <name>maven-jmeter-demo</name>
        <url>http://maven.apache.org</url>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.lazerycode.jmeter</groupId>
                    <artifactId>jmeter-maven-plugin</artifactId>
                    <version>2.7.0</version>
                    <executions>
                        <execution>
                            <id>jmeter-tests</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jmeter</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <jmeterExtensions>
                            <artifact>kg.apc:jmeter-plugins-json:jar:2.6</artifact>
                            <artifact>kg.apc:jmeter-plugins-manager:0.19</artifact>
                            <artifact>kg.apc:jmeter-plugins-extras-libs:1.4.0</artifact>
                        </jmeterExtensions>
                        <downloadExtensionDependencies>false</downloadExtensionDependencies>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>
    
  2. It might be an issue with Maven caches so I would suggest running it at least once with -U key like:

    mvn -U clean verify
    
  3. If you still experience problems run your test with -X key to enable full debugging output and update your question with it (you might also need to provide your .jmx script)

More information:

  • Maven Command Line Options
  • Five Ways To Launch a JMeter Test without Using the JMeter GUI

EDIT: Thanks Dmitri, this was really helpful. In my case I had to add additional library in the pom.xml to resolve this error.

<artifact>com.jayway.jsonpath:json-path:2.2.0</artifact>

I am editing this answer because more often, people don't look into comments to get the answer.