我使用cloudera quickstart在java中实现hadoop项目: 我的cloudera-quickstart版本是5.8.0 这是错误消息:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
17/04/09 14:11:36 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/04/09 14:11:36 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
17/04/09 14:11:36 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonMappingException
at org.apache.hadoop.mapreduce.Job.getJobSubmitter(Job.java:1291)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1302)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1325)
at StubDriver.main(StubDriver.java:41)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 4 more
我在这个简单的培训项目中检查了我的Referenced Libraries,在buildpath库中,slf4j-api-1.6.1.jar; SLF4J-api1.7.5.jar; slf4j-api.jar都包括在内。
答案 0 :(得分:1)
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
除slf4j-api
jar外,还应添加slf4j-log4j12
jar。
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException
您的项目缺少jackson-mapper-asl
jar。
这些罐子已作为Hadoop库的一部分提供。更新项目CLASSPATH
以包含hadoop classpath
将是最简单的解决方法。