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.
Related
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.
After using java -jar tracker-server.jar "configuration.xml"
I got:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/netty/bootstrap/Bootstrap
at org.traccar.Main.main(Main.java:26)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.bootstrap.Bootstrap
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
... 1 more
I found only its some about third party library. But I'm not friendly with Java.
The ClassNotFoundException is caused by there soem jar file missing from the classpath. Search for the jar what includes the missing class and make it available for the enviroment.
See this thread: java.lang.NoClassDefFoundError: org.jboss.netty.bootstrap.ClientBootstrap
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've just installed maven3 on my macbook using the command
sudo port install maven3
But when I try to run the mvn command I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher
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)
How can I solve this?
I set my Java path:
export JAVA_HOME=/Library/Java/Home
Need to set Maven environment variable as you did for JAVA_HOME.
export M2_HOME = /path/to/maven-directory
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.