java.lang.ClassNotFoundException

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

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

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

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

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

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.

  • DSO with glassfish
    via by msnuser168,
  • Re:DSO with glassfish
    via by msnuser168,
  • Re:Spring WS on Glassfish
    via by msnuser168,
  • Re:NP exception in java.util.Hashtable
    via by efremov,
  • Re:DSO with glassfish
    via by v2cg4ss,
  • Terracotta + Spring + Glassfish
    via by hashcode,
  • The Gradle Jenkins plugin is copying all the environment variables from running Tomcat to Gradle runtime. Since Gradle is using JAVA_OPTS as a valid env var for the JVM, it generates a lot of issues like: {code} Started by user admin Updating http://subversion.jfrog.org/jfrog/build-info/trunk At revision 873 no change for http://subversion.jfrog.org/jfrog/build-info/trunk since the previous build [trunk] $ /opt/tools/gradle/bin/gradle --init-script /opt/jenkins/jobs/build-info-dev-gradle/builds/2010-05-06_15-29-25/init-artifactory.gradle clean build buildInfo Java HotSpot(TM) 64-Bit Server VM warning: MaxNewSize (1310720k) is equal to or greater than the entire heap (262144k). A new generation size of 262080k will be used. Could not load Logmanager "org.apache.juli.ClassLoaderLogManager" java.lang.ClassNotFoundException: org.apache.juli.ClassLoaderLogManager 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) at java.util.logging.LogManager$1.run(LogManager.java:168) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.(LogManager.java:158) at org.gradle.initialization.DefaultLoggingConfigurer.configure(DefaultLoggingConfigurer.java:100) at org.gradle.initialization.DefaultGradleLauncherFactory.(DefaultGradleLauncherFactory.java:49) at org.gradle.GradleLauncher.(GradleLauncher.java:47) at org.gradle.launcher.Main.execute(Main.java:89) at org.gradle.launcher.Main.main(Main.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.gradle.launcher.GradleMain.main(GradleMain.java:54) http://repo-eu.jfrog.org/artifactory/repo/org/jfrog/buildinfo/build-info-extractor-gradle/1.0-SNAPSHOT/build-info-extractor-gradle-1.0-SNAPSHOT.pom .. downloaded (2 KB) {code} The best solution is to filter out dangerous env var (like JAVA_OPTS) from Jenkins JVM before executing Gradle. We can also see if JAVA_OPTS is a good choice for Gradle scripts instead of GRADLE_OPTS?
    via by Frederic Simon,
  • The Gradle Jenkins plugin is copying all the environment variables from running Tomcat to Gradle runtime. Since Gradle is using JAVA_OPTS as a valid env var for the JVM, it generates a lot of issues like: {code} Started by user admin Updating http://subversion.jfrog.org/jfrog/build-info/trunk At revision 873 no change for http://subversion.jfrog.org/jfrog/build-info/trunk since the previous build [trunk] $ /opt/tools/gradle/bin/gradle --init-script /opt/jenkins/jobs/build-info-dev-gradle/builds/2010-05-06_15-29-25/init-artifactory.gradle clean build buildInfo Java HotSpot(TM) 64-Bit Server VM warning: MaxNewSize (1310720k) is equal to or greater than the entire heap (262144k). A new generation size of 262080k will be used. Could not load Logmanager "org.apache.juli.ClassLoaderLogManager" java.lang.ClassNotFoundException: org.apache.juli.ClassLoaderLogManager 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) at java.util.logging.LogManager$1.run(LogManager.java:168) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.(LogManager.java:158) at org.gradle.initialization.DefaultLoggingConfigurer.configure(DefaultLoggingConfigurer.java:100) at org.gradle.initialization.DefaultGradleLauncherFactory.(DefaultGradleLauncherFactory.java:49) at org.gradle.GradleLauncher.(GradleLauncher.java:47) at org.gradle.launcher.Main.execute(Main.java:89) at org.gradle.launcher.Main.main(Main.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.gradle.launcher.GradleMain.main(GradleMain.java:54) http://repo-eu.jfrog.org/artifactory/repo/org/jfrog/buildinfo/build-info-extractor-gradle/1.0-SNAPSHOT/build-info-extractor-gradle-1.0-SNAPSHOT.pom .. downloaded (2 KB) {code} The best solution is to filter out dangerous env var (like JAVA_OPTS) from Jenkins JVM before executing Gradle. We can also see if JAVA_OPTS is a good choice for Gradle scripts instead of GRADLE_OPTS?
    via by Frederic Simon,
    • java.lang.ClassNotFoundException: com.sun.enterprise.server.logging.ServerLogManager at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.util.logging.LogManager$1.run(LogManager.java:166) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.<init>(LogManager.java:156) at com.tc.object.bytecode.hook.impl.ClassProcessorHelper.systemLoaderInitialized(ClassProcessorHelper.java:741) at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1336) at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1295)

    Users with the same issue

    Casper
    4 times, last one,
    Handemelindo
    1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    rp
    3 times, last one,
    1188 more bugmates