java.lang.NoClassDefFoundError

tip

A few things cause this exception: 1) Check if you have all jars and if they're in the correct path when running. 2) Your classpath might be broken, you can define it in the command line with "java -cp yourClassPath" or at your IDE if you're using one.

tip

If you're using Hibernate, this indicates you're missing FasterXML Classmate dependency, which you can add to your dependencies. To add it, the groupId is com.fasterxml and artifactId is Classmate.

tip

Check if you didn't forget to instantiate your topic in the kafka broker.

tip

NoClassDefFoundError means java has failed to find a class you're trying to instantiate, look if you've added the class you're trying to instantiate to the dependencies.

tip

You need to add httpcore to your dependencies. Try adding version 4.3 or further.

tip

You might've forgot to add a dependency or it's written wrong. Also, you might be using incompatible versions of Java and Hibernate. More on this here: https://goo.gl/SjSlRA

tip

This error means there's a class missing in your classpath during runtime. You need to create a jar with all your dependencies and have it in your classpath. Check Maven Assembly Plugin and how to add your dependencies to a jar: https://goo.gl/U2zr8k

tip

jsp-api and servlet-api jars must NOT be deployed by your web app. They should be marked as provided but not deployed by your app.

tip

The server rejects all jars that already belong to the server runtime (such as tomcat-**.jar, servlet**.jar). Consider substituting the CORS filter you're using for this one: https://goo.gl/ctQ7Fs

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • I'm walking through the quickstart tutorial, and indexing WT2G: $ ./bin/trec_terrier.sh -i Setting TERRIER_HOME to /Users/soboroff/terrier-3.6 INFO - TRECCollection read collection specification (1081 files) INFO - Processing /home/collections/WT2G_1999//WT01/B01 INFO - creating the data structures data_1 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.hadoop.io.Text.<clinit>(Text.java:49) at org.terrier.structures.indexing.CompressingMetaIndexBuilder.writeDocumentEntry(CompressingMetaIndexBuilder.java:232) at org.terrier.structures.indexing.CompressingMetaIndexBuilder.writeDocumentEntry(CompressingMetaIndexBuilder.java:212) at org.terrier.indexing.BasicIndexer.indexDocument(BasicIndexer.java:386) at org.terrier.indexing.BasicIndexer.createDirectIndex(BasicIndexer.java:270) at org.terrier.indexing.Indexer.index(Indexer.java:346) at org.terrier.applications.TRECIndexing.index(TRECIndexing.java:122) at org.terrier.applications.TrecTerrier.run(TrecTerrier.java:408) at org.terrier.applications.TrecTerrier.applyOptions(TrecTerrier.java:589) at org.terrier.applications.TrecTerrier.main(TrecTerrier.java:246) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 10 more The lib/ directory is missing a commons-logging jar. I copied a random one from CDH4 I had lying around and it worked.
    via by Ian Soboroff,
  • I'm walking through the quickstart tutorial, and indexing WT2G: $ ./bin/trec_terrier.sh -i Setting TERRIER_HOME to /Users/soboroff/terrier-3.6 INFO - TRECCollection read collection specification (1081 files) INFO - Processing /home/collections/WT2G_1999//WT01/B01 INFO - creating the data structures data_1 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.hadoop.io.Text.<clinit>(Text.java:49) at org.terrier.structures.indexing.CompressingMetaIndexBuilder.writeDocumentEntry(CompressingMetaIndexBuilder.java:232) at org.terrier.structures.indexing.CompressingMetaIndexBuilder.writeDocumentEntry(CompressingMetaIndexBuilder.java:212) at org.terrier.indexing.BasicIndexer.indexDocument(BasicIndexer.java:386) at org.terrier.indexing.BasicIndexer.createDirectIndex(BasicIndexer.java:270) at org.terrier.indexing.Indexer.index(Indexer.java:346) at org.terrier.applications.TRECIndexing.index(TRECIndexing.java:122) at org.terrier.applications.TrecTerrier.run(TrecTerrier.java:408) at org.terrier.applications.TrecTerrier.applyOptions(TrecTerrier.java:589) at org.terrier.applications.TrecTerrier.main(TrecTerrier.java:246) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 10 more The lib/ directory is missing a commons-logging jar. I copied a random one from CDH4 I had lying around and it worked.
    via by Ian Soboroff,
  • Mapreduce issue
    via GitHub by raghuthotakura
    ,
    • java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.hadoop.io.Text.<clinit>(Text.java:49) at org.terrier.structures.indexing.CompressingMetaIndexBuilder.writeDocumentEntry(CompressingMetaIndexBuilder.java:232) at org.terrier.structures.indexing.CompressingMetaIndexBuilder.writeDocumentEntry(CompressingMetaIndexBuilder.java:212) at org.terrier.indexing.BasicIndexer.indexDocument(BasicIndexer.java:386) at org.terrier.indexing.BasicIndexer.createDirectIndex(BasicIndexer.java:270) at org.terrier.indexing.Indexer.index(Indexer.java:346) at org.terrier.applications.TRECIndexing.index(TRECIndexing.java:122) at org.terrier.applications.TrecTerrier.run(TrecTerrier.java:408) at org.terrier.applications.TrecTerrier.applyOptions(TrecTerrier.java:589) at org.terrier.applications.TrecTerrier.main(TrecTerrier.java:246) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 10 more

    Users with the same issue

    Andreas HäberAndreas Häber
    2 times, last one,
    johnxflyjohnxfly
    2 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    andyglickandyglick
    1 times, last one,
    somasundaramsomasundaram
    1 times, last one,
    2285 more bugmates