put command not working. It was working fine before.Please help. I have used dfs and hdfs too. Still not worked



0
[cloudera@localhost ~]$ hadoop fs­ -put /home/cloudera/class2/emp.txt /user/cloudera/abhi2/
Exception in thread "main" java.lang.NoClassDefFoundError: fs­-put
Caused by: java.lang.ClassNotFoundException: fs­-put
	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: fs­-put.  Program will exit.

 


3 Answer(s)


0

Hi Abhishek,

Could you please check if below command is working or not:

$ hadoop fs -copyFromLocal /home/cloudera/class2/emp.txt /user/cloudera/abhi2/

Please share the above command output with me.


0

First I was getting an error than the same command ran. I checked put command also it ran. But I am getting these type of errors in many commands like ls, mkdir etc But after some time they run. I am not able to understand the reason. Please explain me the reason. Your help is needed. I am sharing the whole thing I did.

[cloudera@localhost ~]$ hadoop fs­-copyFromLocal /home/cloudera/class2/emp.txt /user/cloudera/abhi2/
Exception in thread "main" java.lang.NoClassDefFoundError: fs­-copyFromLocal
Caused by: java.lang.ClassNotFoundException: fs­-copyFromLocal
	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: fs­-copyFromLocal.  Program will exit.
[cloudera@localhost ~]$ hadoop fs -copyFromLocal /home/cloudera/class2/emp.txt /user/cloudera/abhi2/
[cloudera@localhost ~]$ hadoop fs­-copyFromLocal /home/cloudera/class2/emp.txt /user/cloudera/abhi2/
Exception in thread "main" java.lang.NoClassDefFoundError: fs­-copyFromLocal
Caused by: java.lang.ClassNotFoundException: fs­-copyFromLocal
	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: fs­-copyFromLocal.  Program will exit.
[cloudera@localhost ~]$ hadoop fs -ls /user/cloudera/abhi2/
Found 1 items
-rw-r--r--   3 cloudera cloudera       3501 2017-09-29 12:55 /user/cloudera/abhi2/emp.txt
[cloudera@localhost ~]$ hadoop fs -rm /user/cloudera/abhi2/emp.txt
Moved: 'hdfs://localhost.localdomain:8020/user/cloudera/abhi2/emp.txt' to trash at: hdfs://localhost.localdomain:8020/user/cloudera/.Trash/Current
[cloudera@localhost ~]$ hadoop fs -ls /user/cloudera/abhi2/
[cloudera@localhost ~]$ hadoop fs -copyFromLocal /user/cloudera/class2/emp.txt /user/cloudera/abhi2/
copyFromLocal: `/user/cloudera/class2/emp.txt': No such file or directory
[cloudera@localhost ~]$ hadoop fs -copyFromLocal /home/cloudera/class2/emp.txt /user/cloudera/abhi2/
[cloudera@localhost ~]$ hadoop fs -ls /user/cloudera/abhi2/
Found 1 items
-rw-r--r--   3 cloudera cloudera       3501 2017-09-29 13:02 /user/cloudera/abhi2/emp.txt
[cloudera@localhost ~]$ hadoop fs -rm /user/cloudera/abhi2/emp.txt
Moved: 'hdfs://localhost.localdomain:8020/user/cloudera/abhi2/emp.txt' to trash at: hdfs://localhost.localdomain:8020/user/cloudera/.Trash/Current
[cloudera@localhost ~]$ hadoop fs -ls /user/cloudera/abhi2/
[cloudera@localhost ~]$ hadoop fs -put /home/cloudera/class2/emp.txt /user/cloudera/abhi2/
[cloudera@localhost ~]$ hadoop fs -copyFromLocal /home/cloudera/class2/emp.txt /user/cloudera/abhi2/
copyFromLocal: `/user/cloudera/abhi2/emp.txt': File exists
[cloudera@localhost ~]$ ^C
[cloudera@localhost ~]$ 

 


0

Hi Abhishek,

You are giving space between the fs and -copyFromLocal. See the below command for which you are getting the error:

[cloudera@localhost ~]$ hadoop fs­-copyFromLocal /home/cloudera/class2/emp.txt /user/cloudera/abhi2/

 

Below command are working for you, as there is space between fs and -copyFromLocal.

[cloudera@localhost ~]$ hadoop fs -copyFromLocal /home/cloudera/class2/emp.txt /user/cloudera/abhi2/
[cloudera@localhost ~]$ hadoop fs -ls /user/cloudera/abhi2/
Found 1 items
-rw-r--r--   3 cloudera cloudera       3501 2017-09-29 13:02 /user/cloudera/abhi2/emp.txt
[cloudera@localhost ~]$ hadoop fs -rm /user/cloudera/abhi2/emp.txt
Moved: 'hdfs://localhost.localdomain:8020/user/cloudera/abhi2/emp.txt' to trash at: hdfs://localhost.localdomain:8020/user/cloudera/.Trash/Current
[cloudera@localhost ~]$ hadoop fs -ls /user/cloudera/abhi2/
[cloudera@localhost ~]$ hadoop fs -put /home/cloudera/class2/emp.txt /user/cloudera/abhi2/

Hope this helps.

Thanks.

Your Answer

Click on this code-snippet-icon icon to add code snippet.

Upload Files (Maximum image file size - 1.5 MB, other file size - 10 MB, total size - not more than 50 MB)

Email
Password