我正在使用-libjars命令在hadoop上运行我的jar并在我的驱动程序中设置了.run()和ToolRunner。 (此程序没有map / reduce,只有PutMerges文件到HDFS)。 当我使用eclipse导出jar时,程序运行完美。但我需要使用我自己的.class文件构建jar,并在执行期间导入第三方库。
我的cmd是:
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
错误是:
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
我已经检查过628 03-07-12 07:33 ch / qos / logback / core / joran / spi / JoranException.class确实存在于我的logback.core中。 有人可以建议吗?谢谢。
答案 0 :(得分:0)
只是为了使您的代码工作,您可以尝试将jar复制到群集上所有节点的HADOOP_HOME / lib /文件夹,然后重新启动群集。