title: JMeter: NoClassDefFoundError error when used jackson jar
body: <p>I'm creating a custom Java sampler in JMeter. It's working just fine. However, when I wanted it to return a result in JSON, JMeter didn't found the .jar for the jackson-databind library, which is needed for the creation of the JSON.</p>
  
  <p>I put it to the /lib/ext folder in the JMeter main directory. I also copied to /lib, to no avail. (I know that /lib/ext shouldn't be used for dependency jars, but JMeter doesn't find my utility jars in /lib in my experience.)</p>
  
  <p>I tried adding the path to the variables search_paths, user.classpath and plugin_dependency_paths in jmeter.properties. I tried with absolute path, relative path, with slash, with backslash, but neither helped.</p>
  
  <p>I tried setting the JMETER_HOME variable to the address of my installation. It worked, yet it didn't help.</p>
  
  <p>I tried running in two environments. The first is within Eclipse (I copied JMeter to a workspace folder, then imported the project), with JMeter 4.0. I got this error in the log:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
      at (creating ObjectMapper here)
      at (creating ResponseJSON here)
      at org.apache.jmeter.protocol.java.sampler.JavaSampler.sample(JavaSampler.java:197) ~[ApacheJMeter_java.jar:4.0 r1823414]
      at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:490) ~[ApacheJMeter_core.jar:4.0 r1823414]
      at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:416) ~[ApacheJMeter_core.jar:4.0 r1823414]
      at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:250) ~[ApacheJMeter_core.jar:4.0 r1823414]
      at java.lang.Thread.run(Thread.java:745) [?:1.8.0_101]
  </code></pre>
  
  <p>I also ran JMeter 3.3 from the .bat file, adding the jars to the same place. I got this error on the console:</p>
  
  <pre><code>Unknown error checking for existence of class: com.fasterxml.jackson.databind.ObjectMapper
  java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/Versioned
          at java.lang.ClassLoader.defineClass1(Native Method)
          at java.lang.ClassLoader.defineClass(Unknown Source)
          at java.security.SecureClassLoader.defineClass(Unknown Source)
          at java.net.URLClassLoader.defineClass(Unknown Source)
          at java.net.URLClassLoader.access$100(Unknown Source)
          at java.net.URLClassLoader$1.run(Unknown Source)
          at java.net.URLClassLoader$1.run(Unknown Source)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Unknown Source)
          at org.apache.logging.log4j.util.LoaderUtil.loadClass(LoaderUtil.java:141)
          at org.apache.logging.log4j.util.LoaderUtil.isClassAvailable(LoaderUtil.java:115)
          at org.apache.logging.log4j.core.util.Loader.isClassAvailable(Loader.java:310)
          at org.apache.logging.log4j.core.config.yaml.YamlConfigurationFactory.&lt;init&gt;(YamlConfigurationFactory.java:47)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
          at java.lang.reflect.Constructor.newInstance(Unknown Source)
          at org.apache.logging.log4j.core.util.ReflectionUtil.instantiate(ReflectionUtil.java:188)
          at org.apache.logging.log4j.core.config.ConfigurationFactory.addFactory(ConfigurationFactory.java:190)
          at org.apache.logging.log4j.core.config.ConfigurationFactory.getInstance(ConfigurationFactory.java:164)
          at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:613)
          at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
          at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
          at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
          at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
          at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
          at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122)
          at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
          at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
          at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
          at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
          at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
          at org.apache.jmeter.JMeter.&lt;clinit&gt;(JMeter.java:109)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
          at java.lang.reflect.Constructor.newInstance(Unknown Source)
          at java.lang.Class.newInstance(Unknown Source)
          at org.apache.jmeter.NewDriver.main(NewDriver.java:246)
  Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.Versioned
          at java.net.URLClassLoader.findClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          ... 43 more
  </code></pre>
  
  <p>I didn't try to debug the classloader, but probably that'll be the next step when I finished posting it here.</p>
  
  <p>I have this version of the file, same as in my POM:</p>
  
  <p><a href="https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.9.4" rel="nofollow noreferrer">https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.9.4</a></p>