java.lang.ClassNotFoundException

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

Needs to add netty-transport-native-epoll with a OS classifier to the classpath, it's not included in netty-all

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

  • I am trying to query mongodb collection from hive; select userId, name from demo; running fine select userId, name from demo where name = 'xyz'; fails with below error message; jars used; mongo-hadoop-core-1.4.0.jar; mongo-hadoop-hive-1.4.0.jar; mongo-java-driver-3.0.2.jar; mongodb version 2.6, cdh4 ---------- Diagnostic Messages for this Task: Error: java.lang.ClassNotFoundException: org.antlr.runtime.CommonToken at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.apache.hadoop.hive.ql.exec.Utilities.serializeExpression(Utilities.java:445) at org.apache.hadoop.hive.ql.io.HiveInputFormat.pushFilters(HiveInputFormat.java:359) at org.apache.hadoop.hive.ql.io.HiveInputFormat.pushProjectionsAndFilters(HiveInputFormat.java:432) at org.apache.hadoop.hive.ql.io.HiveInputFormat.getRecordReader(HiveInputFormat.java:233) at org.apache.hadoop.hive.ql.io.CombineHiveInputFormat.getRecordReader(CombineHiveInputFormat.java:522) at org.apache.hadoop.mapred.MapTask$TrackedRecordReader.<init>(MapTask.java:166) at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:407) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:340) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:160) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1438) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:155) FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask ----------
    via by Deepak Shivamurthy,
  • I am trying to query mongodb collection from hive; select userId, name from demo; running fine select userId, name from demo where name = 'xyz'; fails with below error message; jars used; mongo-hadoop-core-1.4.0.jar; mongo-hadoop-hive-1.4.0.jar; mongo-java-driver-3.0.2.jar; mongodb version 2.6, cdh4 ---------- Diagnostic Messages for this Task: Error: java.lang.ClassNotFoundException: org.antlr.runtime.CommonToken at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.apache.hadoop.hive.ql.exec.Utilities.serializeExpression(Utilities.java:445) at org.apache.hadoop.hive.ql.io.HiveInputFormat.pushFilters(HiveInputFormat.java:359) at org.apache.hadoop.hive.ql.io.HiveInputFormat.pushProjectionsAndFilters(HiveInputFormat.java:432) at org.apache.hadoop.hive.ql.io.HiveInputFormat.getRecordReader(HiveInputFormat.java:233) at org.apache.hadoop.hive.ql.io.CombineHiveInputFormat.getRecordReader(CombineHiveInputFormat.java:522) at org.apache.hadoop.mapred.MapTask$TrackedRecordReader.<init>(MapTask.java:166) at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:407) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:340) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:160) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1438) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:155) FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask ----------
    via by Deepak Shivamurthy,
  • ClassNotFound when starting app
    via Stack Overflow by Daniele Vitali
    ,
  • visual-c++: mai 2015
    via by Unknown author,
  • If i create a FunctionalMunitSuite test and run it from Studio, I'm getting the following error: {code} java.lang.RuntimeException: org.mule.api.config.ConfigurationException: Failed to invoke lifecycle phase "initialise" on object: org.mule.el.mvel.MVELExpressionLanguageWrapper@68ac9ec5 (org.mule.api.lifecycle.InitialisationException) at org.mule.munit.runner.functional.FunctionalMunitSuite.<init>(FunctionalMunitSuite.java:60) at testfunctionaltest.testFunctionalJava.<init>(testFunctionalJava.java:13) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:195) at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:244) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:241) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: org.mule.api.config.ConfigurationException: Failed to invoke lifecycle phase "initialise" on object: org.mule.el.mvel.MVELExpressionLanguageWrapper@68ac9ec5 (org.mule.api.lifecycle.InitialisationException) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:49) at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69) at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:89) at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:222) at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:81) at org.mule.munit.runner.MunitMuleContextFactory.createMuleContext(MunitMuleContextFactory.java:85) at org.mule.munit.runner.MuleContextManager.createMule(MuleContextManager.java:112) at org.mule.munit.runner.functional.FunctionalMunitSuite.<init>(FunctionalMunitSuite.java:51) ... 24 more Caused by: org.mule.api.lifecycle.InitialisationException: Failed to invoke lifecycle phase "initialise" on object: org.mule.el.mvel.MVELExpressionLanguageWrapper@68ac9ec5 at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:124) at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:177) at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:100) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43) ... 31 more Caused by: org.mule.api.lifecycle.LifecycleException: Failed to invoke lifecycle phase "initialise" on object: org.mule.el.mvel.MVELExpressionLanguageWrapper@68ac9ec5 at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:249) at org.mule.lifecycle.phases.MuleContextInitialisePhase.applyLifecycle(MuleContextInitialisePhase.java:71) at org.mule.lifecycle.RegistryLifecycleCallback.doApplyLifecycle(RegistryLifecycleCallback.java:99) at org.mule.lifecycle.RegistryLifecycleCallback.onTransition(RegistryLifecycleCallback.java:71) at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:155) at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:126) at org.mule.registry.AbstractRegistry.fireLifecycle(AbstractRegistry.java:146) at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:116) ... 34 more Caused by: java.lang.NoClassDefFoundError: scala/Function1 at com.mulesoft.weave.mule.el.WeaveExpressionLanguageExtension.configureContext(WeaveExpressionLanguageExtension.scala:12) at org.mule.el.mvel.GlobalVariableResolverFactory.<init>(GlobalVariableResolverFactory.java:39) at org.mule.el.mvel.MVELExpressionLanguage.createStaticContext(MVELExpressionLanguage.java:89) at org.mule.el.mvel.MVELExpressionLanguage.initialise(MVELExpressionLanguage.java:83) at org.mule.el.mvel.MVELExpressionLanguageWrapper.initialise(MVELExpressionLanguageWrapper.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:237) ... 41 more Caused by: java.lang.ClassNotFoundException: scala.Function1 at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 51 more {code}
    via by Julian Pascual,
    • java.lang.ClassNotFoundException: org.antlr.runtime.CommonToken at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.apache.hadoop.hive.ql.exec.Utilities.serializeExpression(Utilities.java:445) at org.apache.hadoop.hive.ql.io.HiveInputFormat.pushFilters(HiveInputFormat.java:359) at org.apache.hadoop.hive.ql.io.HiveInputFormat.pushProjectionsAndFilters(HiveInputFormat.java:432) at org.apache.hadoop.hive.ql.io.HiveInputFormat.getRecordReader(HiveInputFormat.java:233) at org.apache.hadoop.hive.ql.io.CombineHiveInputFormat.getRecordReader(CombineHiveInputFormat.java:522) at org.apache.hadoop.mapred.MapTask$TrackedRecordReader.<init>(MapTask.java:166) at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:407) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:340) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:160) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1438) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:155)

    Users with the same issue

    batwalrus76batwalrus76
    1 times, last one,
    MattyMatty
    1 times, last one,
    oddodd
    1 times, last one,
    tvrmsmithtvrmsmith
    2 times, last one,
    junior_cEngineerjunior_cEngineer
    1 times, last one,
    2331 more bugmates