可以从多个模块访问org.apache.hadoop.util包:hadoop.auth,hadoop.common

时间:2018-06-17 10:41:51

标签: java eclipse hadoop mapreduce

我正在eclipse中为mapreduce创建我的第一个程序。 当我导入以下两个包时出错:

import org.apache.hadoop.util.Tool;

import org.apache.hadoop.util.ToolRunner;

Error:The package org.apache.hadoop.util is accessible from more than one module: hadoop.auth, hadoop.common

所以,我试图删除jar文件hadoop-auth-3.1.0.jar,错误已经消失,但在运行时,我遇到错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/util/PlatformName
    at org.apache.hadoop.security.UserGroupInformation.getOSLoginModuleName(UserGroupInformation.java:412)
    at org.apache.hadoop.security.UserGroupInformation.<clinit>(UserGroupInformation.java:457)
    at org.apache.hadoop.mapreduce.task.JobContextImpl.<init>(JobContextImpl.java:72)
    at org.apache.hadoop.mapreduce.Job.<init>(Job.java:150)
    at org.apache.hadoop.mapreduce.Job.<init>(Job.java:129)
    at org.hadoop.trainings.WordCount.run(WordCount.java:33)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
    at org.hadoop.trainings.WordCount.main(WordCount.java:56)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.PlatformName
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)

0 个答案:

没有答案