Skip to content

JMeter ClassNotFoundException & NoClassDefFoundError

Fix JMeter java.lang.ClassNotFoundException and NoClassDefFoundError. Understand lib/ vs lib/ext/ directory structure, JDBC drivers, and classpath setup.

Difficulty
beginner
Guide type
troubleshooting
Estimated read time
6 min read
Last verified version
Verified JMeter 5.6

ClassNotFoundException & NoClassDefFoundError in JMeter

Section titled “ClassNotFoundException & NoClassDefFoundError in JMeter”

When starting JMeter, opening a JMX file, or running a test involving JDBC, custom plugins, or Groovy libraries, an error occurs in the console or jmeter.log:

java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

Or when opening a Test Plan that depends on an uninstalled plugin:

2026-08-18 11:20:01 ERROR o.a.j.g.a.Load: Unexpected error
java.lang.NoClassDefFoundError: kg/apc/jmeter/vizualizers/CorrectedResultCollector

The test fails to start, or samplers throw runtime exceptions during execution.

ClassNotFoundException and NoClassDefFoundError occur when JMeter’s Java ClassLoader cannot find a required .jar file on its classpath. The fix is placing the missing JAR file into the correct directory (lib/ for drivers/libraries vs lib/ext/ for JMeter plugins) and restarting JMeter.

JMeter Classpath Architecture: lib/ vs lib/ext/

Section titled “JMeter Classpath Architecture: lib/ vs lib/ext/”

JMeter uses a hierarchical classloader structure:

DirectoryWhat belongs hereExamples
JMETER_HOME/lib/Utility JARs, 3rd-party dependencies, JDBC database drivers, messaging client JARsmysql-connector-j-8.x.jar, postgresql-42.x.jar, ojdbc8.jar, kafka-clients.jar
JMETER_HOME/lib/ext/JMeter GUI components, visualizers, samplers, and official plugin bundlesjmeter-plugins-cmn-jmeter.jar, jmeter-plugins-webdriver.jar
JMETER_HOME/lib/junit/JUnit test classes if using the JUnit SamplerCustom compiled JUnit test JARs

Always Restart JMeter

Java cannot dynamically reload JAR files dropped into lib/ or lib/ext/ while JMeter is running. You must restart JMeter (or re-run the CLI command) for new JARs to take effect.

For database testing (JDBC Connection Configuration), download the JDBC driver .jar and place it into JMETER_HOME/lib/:

  • MySQL: mysql-connector-j-8.x.jar -> lib/
  • PostgreSQL: postgresql-42.x.jar -> lib/
  • Oracle: ojdbc8.jar -> lib/
  • Microsoft SQL Server: mssql-jdbc-xx.jar -> lib/
Terminal window
# Example: Copying PostgreSQL driver to JMeter lib directory
cp postgresql-42.7.3.jar /opt/apache-jmeter/lib/

2. Install Missing Plugins via JMeter Plugins Manager

Section titled “2. Install Missing Plugins via JMeter Plugins Manager”

If a .jmx script contains elements prefixed with kg.apc.jmeter (Custom Thread Groups, Dummy Sampler, Throughput Shaping Timer):

  1. Download jmeter-plugins-manager.jar from jmeter-plugins.org.
  2. Place it into JMETER_HOME/lib/ext/.
  3. Start JMeter GUI -> Options -> Plugins Manager.
  4. The Plugins Manager will detect any missing plugins in the loaded test plan and offer to install them automatically with one click.

3. Add Custom JARs via user.properties (Without Copying Files)

Section titled “3. Add Custom JARs via user.properties (Without Copying Files)”

If you maintain a shared repository of corporate JARs or CI/CD dependencies, add them to user.properties without moving files:

# Add custom directory or individual JAR paths (comma or semicolon separated)
user.classpath=/opt/shared/jars/custom-crypto.jar;/opt/shared/drivers/
plugin_dependency_paths=/opt/jmeter/plugins/

When running in CI/CD pipelines (GitHub Actions / Jenkins / Docker):

Terminal window
# Pass user.classpath dynamically via command line
jmeter -n -t plan.jmx -Juser.classpath=/libs/mysql.jar -l results.jtl -j jmeter.log

5. Verify Distributed Testing Worker Nodes

Section titled “5. Verify Distributed Testing Worker Nodes”

In distributed testing, every remote worker node (jmeter-server) must have identical JAR files installed in their respective lib/ and lib/ext/ folders. The controller does not transmit JAR files to workers over RMI.

ResourceUse when
JDBC Connection Pool errorsResolving database connection errors
Plugins EssentialsInstalling and managing JMeter plugins
CLI Command BuilderBuilding CLI commands with custom property flags
Distributed testingSyncing dependencies across worker nodes

Putting JDBC drivers in lib/ext/ can cause classloader conflicts or failure to register with Java’s DriverManager. Always place utility libraries and database drivers in lib/, and place JMeter GUI plugins in lib/ext/.

Why does the script fail in CI/CD when it worked on my laptop?

Section titled “Why does the script fail in CI/CD when it worked on my laptop?”

Your local JMeter installation has plugins or JDBC drivers in lib/ or lib/ext/ that were not packaged into the CI/CD Docker image or runner environment.

On this page