java.lang.NoClassDefFoundError

tip

Look if your classpath is correct, and check if the versions of your libraries match the version you described in your pom.xml

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

  • Whenever we need to restart tomcat hudson comes with a series of class not found exceptions when starting a maven job. Either hudson.EnvVars or hudson.Main - the classes are definetly in the classpach (checked WEB-INF/lib/hudson-core). After a number of restarts of tomcat (3-10) it sometimes works again. FATAL: Could not initialize class hudson.EnvVars java.lang.NoClassDefFoundError: Could not initialize class hudson.EnvVars at hudson.model.Computer.getEnvironment(Computer.java:736) at hudson.model.Run.getEnvironment(Run.java:1648) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:663) at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:128) at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:384) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416) at hudson.model.Run.run(Run.java:1243) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:304) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:122) OR FATAL: hudson/Main (wrong name: Main) java.lang.NoClassDefFoundError: hudson/Main (wrong name: Main) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1302) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) at hudson.EnvVars.initMaster(EnvVars.java:223) at hudson.EnvVars.<clinit>(EnvVars.java:218) at hudson.model.Computer.getEnvironment(Computer.java:736) at hudson.model.Run.getEnvironment(Run.java:1648) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:663) at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:128) at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:384) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416) at hudson.model.Run.run(Run.java:1243) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:304) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:122)
    via by ajuffinger,
  • Whenever we need to restart tomcat hudson comes with a series of class not found exceptions when starting a maven job. Either hudson.EnvVars or hudson.Main - the classes are definetly in the classpach (checked WEB-INF/lib/hudson-core). After a number of restarts of tomcat (3-10) it sometimes works again. FATAL: Could not initialize class hudson.EnvVars java.lang.NoClassDefFoundError: Could not initialize class hudson.EnvVars at hudson.model.Computer.getEnvironment(Computer.java:736) at hudson.model.Run.getEnvironment(Run.java:1648) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:663) at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:128) at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:384) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416) at hudson.model.Run.run(Run.java:1243) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:304) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:122) OR FATAL: hudson/Main (wrong name: Main) java.lang.NoClassDefFoundError: hudson/Main (wrong name: Main) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1302) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) at hudson.EnvVars.initMaster(EnvVars.java:223) at hudson.EnvVars.<clinit>(EnvVars.java:218) at hudson.model.Computer.getEnvironment(Computer.java:736) at hudson.model.Run.getEnvironment(Run.java:1648) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:663) at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:128) at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:384) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416) at hudson.model.Run.run(Run.java:1243) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:304) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:122)
    via by ajuffinger,
  • Struts2 Hello World jsp example error
    via Stack Overflow by lulu88
    ,
  • integrate gerrit with github
    via by Ameya Varade,
  • Spring Framework 3.0.5 MVC Issue
    via Stack Overflow by eastonw2
    ,
  • Tomcat 6 + Jsf 1.2
    via by Felix Coutinho,
    • java.lang.NoClassDefFoundError: hudson/Main (wrong name: Main) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1302) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) at hudson.EnvVars.initMaster(EnvVars.java:223) at hudson.EnvVars.<clinit>(EnvVars.java:218) at hudson.model.Computer.getEnvironment(Computer.java:736) at hudson.model.Run.getEnvironment(Run.java:1648) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:663) at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:128) at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:384) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416) at hudson.model.Run.run(Run.java:1243) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:304) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:122)

    Users with the same issue

    junior_cEngineer
    1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    andyglick
    2 times, last one,
    Unknown visitor1 times, last one,
    164 more bugmates