Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Could not find or load main class dfsadmin

avatar
Super Collaborator

Was trying to run 'hdfs dfsadmin -safemode enter'. It was throwing message saying 'could not find or load main class dfsadmin'.

Can someone help me understanding under which circumstances would we get this error and what is the work around to make it work.

Thank you in advance

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Viswa

One of the reason can be special characters (Non printable) in the command Because the error that you are getting can occur if "hdfs" command is not able to locate the class related to the argument.

Example::

# hdfs dsfadmin -safemode enter
Error: Could not find or load main class dsfadmin

- In this example i intentionally made a spelling mistake in 'dfsadmin" argument to explain. In your case it might be due to some special hidden chars.

.

So you should try check that you are not copying and pasting the command in the terminal... instead try to manually type the command.

Also check the output of the following to see if you are getting the correct command output:

#  hdfs --help | grep dfsadmin
  dfsadmin             run a DFS admin client

View solution in original post

2 REPLIES 2

avatar
Master Mentor

@Viswa

One of the reason can be special characters (Non printable) in the command Because the error that you are getting can occur if "hdfs" command is not able to locate the class related to the argument.

Example::

# hdfs dsfadmin -safemode enter
Error: Could not find or load main class dsfadmin

- In this example i intentionally made a spelling mistake in 'dfsadmin" argument to explain. In your case it might be due to some special hidden chars.

.

So you should try check that you are not copying and pasting the command in the terminal... instead try to manually type the command.

Also check the output of the following to see if you are getting the correct command output:

#  hdfs --help | grep dfsadmin
  dfsadmin             run a DFS admin client

avatar
Super Collaborator

tried the same command again later, it worked. haven't changed anything.

Thank you Jay SenSharma