Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/hadoop/util/PlatformName

匿名 (未验证) 提交于 2019-12-03 02:20:02

问题:

I know there have been many posts regarding this exception, but I am not able to fix this issue. Classpath has to be edited I think to resolve it. I am trying to run a program called DistMap in hadoop infrastructure. This is the error I am getting.

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 

which java says

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

echo $CLASSPATH gives a blank line

cat ~/.bash_profile says

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 

Update:

$HADOOP_HOME /usr/lib/hadoop

$HADOOP_CLASSPATH

The last 2 jar files have those classes PlatformName and FsShell. Still its not working.

Can anyone please help me fix this issue?

Thanks

回答1:

hadoop-auth-2.2.0.jar should be there for hadoop2.2.0
Add hadoop auth jar for your version



回答2:

If you are a maven user and faced this issue -

    <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> 

NOTE: :hadoop-client:2.5.2 alone didn't bring in all the required hadoop dependencies. That is why I added hadoop-common, which brought all the required deps.



回答3:

Hadoop HADOOP_CLASSPATH issues

This would be helpful.

Thanks & Regards,
Alok Thaker



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!