Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Could not find or load main class dfsadmin

Solved Go to solution
Highlighted

Could not find or load main class dfsadmin

Expert Contributor

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

Accepted Solutions

Re: Could not find or load main class dfsadmin

Super 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
2 REPLIES 2

Re: Could not find or load main class dfsadmin

Super 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

Re: Could not find or load main class dfsadmin

Expert Contributor

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

Thank you Jay SenSharma

Don't have an account?
Coming from Hortonworks? Activate your account here