java.lang.NoClassDefFoundError

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
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.

  • nexus-repository-conversion-tool fails when run with java -jar as per the documentation on https://docs.sonatype.com/display/SPRTNXOSS/Nexus+Command+Line+Tools. The error and stack trace can be seen below. java -jar ~/nexus-repository-conversion-tool-2.0.4-1-cli.jar Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableList at com.google.inject.internal.Errors.<clinit>(Errors.java:648) at com.google.inject.internal.InternalInjectorCreator.<init>(InternalInjectorCreator.java:62) at com.google.inject.Guice.createInjector(Guice.java:96) at com.google.inject.Guice.createInjector(Guice.java:73) at com.google.inject.Guice.createInjector(Guice.java:62) at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:470) at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:196) at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:160) at org.codehaus.plexus.tools.cli.AbstractCli.execute(AbstractCli.java:159) at org.codehaus.plexus.tools.cli.AbstractCli.execute(AbstractCli.java:67) at org.sonatype.nexus.tools.repository.RepositoryConvertorCli.main(RepositoryConvertorCli.java:53) Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableList 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) ... 11 more I think it's a missing Guava dependency. When I downloaded Guava 12.0 and ran "java -cp $HOME/guava-12.0.jar:$HOME/nexus-repository-conversion-tool-2.0.4-1-cli.jar org.sonatype.nexus.tools.repository.RepositoryConvertorCli -r foo -o bar" it worked.
    via by Brandon Richins,
  • ClassNotFoundException and NoClassDefException
    via by Unknown author,
  • GitHub comment 136#268126209
    via GitHub by edmilsonrobson
    ,
  • Google Guice can&#39;t find class
    via Stack Overflow by bukashka101
    ,
  • Looks like that xUnit plugin v1.29 doesn't work correctly when working on slave. I get the error (see below). Looks like he tries to access a file "C:\Jenkins\userContent\xunit/BoostTest/1.x" which doesn't exist. Version 1.27 of plugin works correctly. [xUnit] [ERROR] - Conversion error remote file operation failed: C:\Jenkins\userContent\xunit/BoostTest/1.x at hudson.remoting.Channel@1ac04e8:channel ERROR: Publisher com.thalesgroup.hudson.plugins.xunit.XUnitPublisher aborted due to exception hudson.util.IOException2: remote file operation failed: C:\Jenkins\workspace\Anton-test at hudson.remoting.Channel@1510a2d:telco-builder at hudson.FilePath.act(FilePath.java:781) at hudson.FilePath.act(FilePath.java:767) at com.thalesgroup.hudson.plugins.xunit.XUnitPublisher.performTests(XUnitPublisher.java:164) at com.thalesgroup.hudson.plugins.xunit.XUnitPublisher.performXUnit(XUnitPublisher.java:112) at com.thalesgroup.hudson.plugins.xunit.XUnitPublisher.perform(XUnitPublisher.java:89) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:694) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:669) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:647) at hudson.model.Build$RunnerImpl.post2(Build.java:162) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:616) at hudson.model.Run.run(Run.java:1429) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:230) Caused by: hudson.util.IOException2: There are some problems during the conversion into JUnit reports: at com.thalesgroup.hudson.plugins.xunit.service.XUnitTransformer.invoke(XUnitTransformer.java:164) at com.thalesgroup.hudson.plugins.xunit.service.XUnitTransformer.invoke(XUnitTransformer.java:37) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2022) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:287) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: com.thalesgroup.hudson.plugins.xunit.exception.XUnitException: Conversion error remote file operation failed: C:\Jenkins\userContent\xunit/BoostTest/1.x at hudson.remoting.Channel@1ac04e8:channel at com.thalesgroup.hudson.plugins.xunit.service.XUnitConversionService.convert(XUnitConversionService.java:93) at com.thalesgroup.hudson.plugins.xunit.service.XUnitTransformer.invoke(XUnitTransformer.java:135) ... 11 more Caused by: hudson.util.IOException2: remote file operation failed: C:\Jenkins\userContent\xunit/BoostTest/1.x at hudson.remoting.Channel@1ac04e8:channel at hudson.FilePath.act(FilePath.java:781) at hudson.FilePath.act(FilePath.java:767) at hudson.FilePath.exists(FilePath.java:1035) at com.thalesgroup.hudson.plugins.xunit.service.XUnitConversionService.convertInputMetricXSL(XUnitConversionService.java:112) at com.thalesgroup.hudson.plugins.xunit.service.XUnitConversionService.convert(XUnitConversionService.java:82) ... 12 more Caused by: java.io.IOException: Remote call on channel failed at hudson.remoting.Channel.call(Channel.java:690) at hudson.FilePath.act(FilePath.java:774) ... 16 more Caused by: java.lang.NoClassDefFoundError: hudson/remoting/RemoteClassLoader$RemoteIClassLoader at hudson.remoting.RemoteClassLoader.export(RemoteClassLoader.java:353) at hudson.remoting.UserRequest.<init>(UserRequest.java:69) at hudson.remoting.Channel.call(Channel.java:680) ... 17 more Caused by: java.lang.ClassNotFoundException: hudson.remoting.RemoteClassLoader$RemoteIClassLoader 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) ... 20 more Finished: FAILURE
    via by Anton Nikitin,
  • Looks like that xUnit plugin v1.29 doesn't work correctly when working on slave. I get the error (see below). Looks like he tries to access a file "C:\Jenkins\userContent\xunit/BoostTest/1.x" which doesn't exist. Version 1.27 of plugin works correctly. [xUnit] [ERROR] - Conversion error remote file operation failed: C:\Jenkins\userContent\xunit/BoostTest/1.x at hudson.remoting.Channel@1ac04e8:channel ERROR: Publisher com.thalesgroup.hudson.plugins.xunit.XUnitPublisher aborted due to exception hudson.util.IOException2: remote file operation failed: C:\Jenkins\workspace\Anton-test at hudson.remoting.Channel@1510a2d:telco-builder at hudson.FilePath.act(FilePath.java:781) at hudson.FilePath.act(FilePath.java:767) at com.thalesgroup.hudson.plugins.xunit.XUnitPublisher.performTests(XUnitPublisher.java:164) at com.thalesgroup.hudson.plugins.xunit.XUnitPublisher.performXUnit(XUnitPublisher.java:112) at com.thalesgroup.hudson.plugins.xunit.XUnitPublisher.perform(XUnitPublisher.java:89) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:694) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:669) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:647) at hudson.model.Build$RunnerImpl.post2(Build.java:162) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:616) at hudson.model.Run.run(Run.java:1429) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:230) Caused by: hudson.util.IOException2: There are some problems during the conversion into JUnit reports: at com.thalesgroup.hudson.plugins.xunit.service.XUnitTransformer.invoke(XUnitTransformer.java:164) at com.thalesgroup.hudson.plugins.xunit.service.XUnitTransformer.invoke(XUnitTransformer.java:37) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2022) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:287) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: com.thalesgroup.hudson.plugins.xunit.exception.XUnitException: Conversion error remote file operation failed: C:\Jenkins\userContent\xunit/BoostTest/1.x at hudson.remoting.Channel@1ac04e8:channel at com.thalesgroup.hudson.plugins.xunit.service.XUnitConversionService.convert(XUnitConversionService.java:93) at com.thalesgroup.hudson.plugins.xunit.service.XUnitTransformer.invoke(XUnitTransformer.java:135) ... 11 more Caused by: hudson.util.IOException2: remote file operation failed: C:\Jenkins\userContent\xunit/BoostTest/1.x at hudson.remoting.Channel@1ac04e8:channel at hudson.FilePath.act(FilePath.java:781) at hudson.FilePath.act(FilePath.java:767) at hudson.FilePath.exists(FilePath.java:1035) at com.thalesgroup.hudson.plugins.xunit.service.XUnitConversionService.convertInputMetricXSL(XUnitConversionService.java:112) at com.thalesgroup.hudson.plugins.xunit.service.XUnitConversionService.convert(XUnitConversionService.java:82) ... 12 more Caused by: java.io.IOException: Remote call on channel failed at hudson.remoting.Channel.call(Channel.java:690) at hudson.FilePath.act(FilePath.java:774) ... 16 more Caused by: java.lang.NoClassDefFoundError: hudson/remoting/RemoteClassLoader$RemoteIClassLoader at hudson.remoting.RemoteClassLoader.export(RemoteClassLoader.java:353) at hudson.remoting.UserRequest.<init>(UserRequest.java:69) at hudson.remoting.Channel.call(Channel.java:680) ... 17 more Caused by: java.lang.ClassNotFoundException: hudson.remoting.RemoteClassLoader$RemoteIClassLoader 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) ... 20 more Finished: FAILURE
    via by Anton Nikitin,
  • no class found exception
    via GitHub by mohsin111
    ,
    • java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableList at com.google.inject.internal.Errors.<clinit>(Errors.java:648) at com.google.inject.internal.InternalInjectorCreator.<init>(InternalInjectorCreator.java:62) at com.google.inject.Guice.createInjector(Guice.java:96) at com.google.inject.Guice.createInjector(Guice.java:73) at com.google.inject.Guice.createInjector(Guice.java:62) at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:470) at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:196) at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:160) at org.codehaus.plexus.tools.cli.AbstractCli.execute(AbstractCli.java:159) at org.codehaus.plexus.tools.cli.AbstractCli.execute(AbstractCli.java:67) at org.sonatype.nexus.tools.repository.RepositoryConvertorCli.main(RepositoryConvertorCli.java:53) Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableList 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) ... 11 more

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    chenjunjunchenjunjun
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    2285 more bugmates