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.

  • When i try to deploy an ear with the deploy-plugin i got the following error: {code} FATAL: org/apache/tools/ant/BuildException java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException at org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory.<init>(DefaultConfigurationFactory.java:48) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:79) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:72) at hudson.FilePath.act(FilePath.java:756) at hudson.FilePath.act(FilePath.java:738) at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:72) at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:45) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:622) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:601) at hudson.maven.MavenModuleSetBuild$RunnerImpl.post2(MavenModuleSetBuild.java:762) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:548) at hudson.model.Run.run(Run.java:1386) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:405) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:145) Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.BuildException 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:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 16 more {code} It does not matter which application server I choose. I put the following libraries in lib-folder of the jenkins: cargo-ant-1.0.5.jar cargo-core-api-container-1.0.5.jar cargo-core-api-generic-1.0.5.jar cargo-core-api-module-1.0.5.jar cargo-core-api-util-1.0.5.jar cargo-core-container-jboss-1.0.5.jar cargo-core-tools-jboss-deployer-5.1-and-onwards-1.0.5.jar cargo-core-uberjar-1.0.5.jar jboss-jmx-remoting.jar jboss-remoting-aspects.jar jboss-remoting.jar
    via by sorehead,
  • When i try to deploy an ear with the deploy-plugin i got the following error: {code} FATAL: org/apache/tools/ant/BuildException java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException at org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory.<init>(DefaultConfigurationFactory.java:48) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:79) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:72) at hudson.FilePath.act(FilePath.java:756) at hudson.FilePath.act(FilePath.java:738) at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:72) at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:45) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:622) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:601) at hudson.maven.MavenModuleSetBuild$RunnerImpl.post2(MavenModuleSetBuild.java:762) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:548) at hudson.model.Run.run(Run.java:1386) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:405) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:145) Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.BuildException 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:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 16 more {code} It does not matter which application server I choose. I put the following libraries in lib-folder of the jenkins: cargo-ant-1.0.5.jar cargo-core-api-container-1.0.5.jar cargo-core-api-generic-1.0.5.jar cargo-core-api-module-1.0.5.jar cargo-core-api-util-1.0.5.jar cargo-core-container-jboss-1.0.5.jar cargo-core-tools-jboss-deployer-5.1-and-onwards-1.0.5.jar cargo-core-uberjar-1.0.5.jar jboss-jmx-remoting.jar jboss-remoting-aspects.jar jboss-remoting.jar
    via by sorehead,
  • Running Spark application on AWS EMR
    via Stack Overflow by Vijayasarathy
    ,
  • Master Detail Flow App Error - thenewboston Forum
    via by Unknown author,
    • java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException at org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory.<init>(DefaultConfigurationFactory.java:48) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:79) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:72) at hudson.FilePath.act(FilePath.java:756) at hudson.FilePath.act(FilePath.java:738) at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:72) at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:45) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:622) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:601) at hudson.maven.MavenModuleSetBuild$RunnerImpl.post2(MavenModuleSetBuild.java:762) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:548) at hudson.model.Run.run(Run.java:1386) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:405) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:145) Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.BuildException 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:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 16 more

    Users with the same issue

    Unknown visitor1 times, last one,
    Matty
    1 times, last one,
    odd
    1 times, last one,
    tvrmsmith
    2 times, last one,
    Unknown visitor1 times, last one,
    2285 more bugmates