I get the following error when I try to run my main method:
java.lang.NoClassDefFoundError: com/hsv/generics/PrintArrays
Caused by: java.lang.ClassNotFoundException: com.hsv.generics.PrintArrays
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)
Exception in thread "main"
Why is this happening, I think it may be to do with CLASSPATH evironment variable but I dont know what to change it to.
Related
I am trying to start tomcat from command prompt getting below error
C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin>java org.apache.catal
ina.startup.Bootstrap
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/catalina/s tartup/Bootstrap
Caused by: java.lang.ClassNotFoundException:
org.apache.catalina.startup.Bootstrap
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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: org.apache.catalina.startup.Bootstrap.
Program window
Please suggest how to resolve this.
Thanks.
I work with Pig embeded in Java. I want to instantiate PigServer to execute a Pig sentence. My first sentence is:
PigServer pigServer = new PigSever("local")
When I execute this code I got the following error:
log4j:ERROR Could not instantiate class [org.apache.hadoop.log.metrics.EventCounter].
java.lang.ClassNotFoundException: org.apache.hadoop.log.metrics.EventCounter
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)
at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:326)
at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:123)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:752)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:547)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:483)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
at org.apache.log4j.Logger.getLogger(Logger.java:104)
at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:102)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:246)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
at org.apache.pig.impl.util.PropertiesUtil.<clinit>(PropertiesUtil.java:33)
at org.apache.pig.PigServer.<init>(PigServer.java:192)
at org.apache.pig.PigServer.<init>(PigServer.java:182)
at bicing.pig.PigEstadisticas.main(PigEstadisticas.java:18)
log4j:ERROR Could not instantiate appender named "EventCounter".
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/security/Credentials
at org.apache.hadoop.mapred.JobConf.<init>(JobConf.java:325)
at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.init(HExecutionEngine.java:175)
at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.init(HExecutionEngine.java:117)
at org.apache.pig.impl.PigContext.connect(PigContext.java:240)
at org.apache.pig.PigServer.<init>(PigServer.java:215)
at org.apache.pig.PigServer.<init>(PigServer.java:200)
at org.apache.pig.PigServer.<init>(PigServer.java:196)
at org.apache.pig.PigServer.<init>(PigServer.java:192)
at org.apache.pig.PigServer.<init>(PigServer.java:182)
at bicing.pig.PigEstadisticas.main(PigEstadisticas.java:18)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.security.Credentials
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)
... 10 more
I'm wondering because I don't know what jar I have to import.
Could somebody help me?
I think you need hadoop-commmon for this class.
http://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common/2.7.2
I am trying to start Hive in CDH 4.2 and I am running into the below issue
hive
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/util/PlatformName
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.PlatformName
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)
Could not find the main class: org.apache.hadoop.util.PlatformName. Program will exit.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/util/RunJar
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.RunJar
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)
Could not find the main class: org.apache.hadoop.util.RunJar. Program will exit.
Giving below are the environment parameters for reference. Am I missing something?
echo $HADOOP_CONF_DIR /etc/hadoop/conf/conf.pseudo
echo $HADOOP_HOME /usr/lib/hadoop-0.20-mapreduce
echo $CLASSPATH
/usr/lib/hadoop-0.20-mapreduce/hadoop-core.jar;/usr/lib/hadoop/hadoop-auth-2.0.0-cdh4.2.0.jar;/usr/lib/hadoop-0.20-mapreduce/.;
echo $HIVE_HOME
Let me know if you would like to review any other environment variable that I may be missing here.
I am using the -libjars command to run my jar on hadoop and have set up .run() and ToolRunner in my driver program. (This program has no map/reduce, only PutMerges files to HDFS).
When I export the jar using eclipse, the program works perfectly. But I need to build the jar with only my own .class files and import 3rd party libraries during execution.
my cmd is:
hadoop jar myjar.jar package.classname -libjars mypath/logback-core-1.0.1.jar,logback-classic-1.0.1.jar,jul-to-slf4j-1.6.4.jar,jcl-over-slf4j-1.6.4.jar,slf4j-api-1.6.4.jar,log4j-over-slf4j-1.6.4.jar arg1 arg2 arg3 arg4
the error is:
Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:150)
at org.apache.hadoop.util.RunJar.main(RunJar.java:143)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.joran.spi.JoranException
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)
... 9 more
Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:150)
at org.apache.hadoop.util.RunJar.main(RunJar.java:143)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.joran.spi.JoranException
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)
... 9 more
I have checked that 628 03-07-12 07:33 ch/qos/logback/core/joran/spi/JoranException.class does indeed exist in my logback.core.
Could anyone advise? Thank you.
Just for making your code work you can try to copy the jars to the HADOOP_HOME/lib/ folder of all nodes on the cluster and then restart the cluster.
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/derby/drda/NetworkServerControl Caused by:
java.lang.ClassNotFoundException:
org.apache.derby.drda.NetworkServerControl
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)
Furthermore netbeans can't find
import javax.persistence.*;