线程“main”java.lang.noclassdeffounderror中出现异常:org/apache/hadoop/util/platformname

aiazj4mn  于 2021-06-03  发布在  Hadoop
关注(0)|答案(4)|浏览(553)

我知道有很多关于这个例外的帖子,但是我不能解决这个问题。我认为必须编辑类路径才能解决它。我试图在hadoop基础设施中运行一个名为distmap的程序。这就是我得到的错误。

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/fs/FsShell
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FsShell
        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.fs.FsShell.  Program will exit.
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/fs/FsShell
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FsShell
        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.fs.FsShell.  Program will exit.
Error could not create input directory /distmap_output_input folder on hdfs file system

java 说

/usr/java/jdk1.6.0_32/bin/java

echo$classpath给出一个空行
猫~/.bash\u简介说

cat ~/.bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

更新:
$hadoop\u主页 /usr/lib/hadoop $hadoop\u类路径 /usr/lib/hadoop-0.20-mapreduce/hadoop-ant-2.0.0-mr1-cdh4.4.0.jar:/usr/lib/hadoop‌​-0.20-mapreduce/hadoop-ant.jar:/usr/lib/hadoop-0.20-mapreduce/hadoop-examples-2.0‌​.0-mr1-cdh4.4.0.jar:/usr/lib/hadoop-0.20-mapreduce/hadoop-examples.jar:/usr/lib/h‌​adoop-0.20-mapreduce/hadoop-core.jar:/usr/lib/hadoop-0.20-mapreduce/hadoop-core-2‌​.0.0-mr1-cdh4.4.0.jar:/usr/lib/hadoop-0.20-mapreduce/hadoop-test-2.0.0-mr1-cdh4.4‌​.0.jar:/usr/lib/hadoop-0.20-mapreduce/hadoop-test.jar:/usr/lib/hadoop-0.20-mapreduce/hadoop-tools-2.0.0-mr1-cdh4.4.0.jar:/usr/lib/hado‌​op-0.20-mapreduce/hadoop-tools.jar:/usr/lib/hadoop-0.20-mapreduce/lib/*jar:/usr/lib/hadoop/hadoop-common.jar:/usr/lib/hadoop/hadoop-common-2.0.0-cdh4.4.0.jar 最后两个jar文件包含platformname和fsshell类。它仍然不起作用。
有人能帮我解决这个问题吗?
谢谢

wyyhbhjk

wyyhbhjk1#

如果你是一个专业的用户并且面对这个问题-

<dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-client</artifactId>
        <version>${hadoop.client.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>${hadoop.client.version}</version>
    </dependency>

注: :hadoop-client:2.5.2 单独使用并没有带来所有必需的hadoop依赖项。所以我补充说 hadoop-common ,它带来了所有必需的dep。

c9x0cxw0

c9x0cxw02#

hadoop-auth-2.2.0.jar应该在hadoop2.2.0中
为您的版本添加hadoop auth jar

dgiusagp

dgiusagp3#

在我的特殊情况下,我使用的是maven,虽然我在pom和类路径中都有hadoop auth,但是我仍然得到了这个异常。
对我来说,最终解决这个问题的方法是将pom中依赖项的范围从“provided”改为“compile”。

mcvgt66p

mcvgt66p4#

hadoop hadoop\u类路径问题
这会很有帮助。
谢谢和问候,
阿洛克萨克

相关问题