How Do You Troubleshoot the Hadoop Message “Exception in thread “main” java.nio.file.AccessDeniedException: /home/jdoe/./mapper.py”?

Problem scenario
You are trying to run a hadoop command (to kick off a mapreduce job). But you get this error:
"Exception in thread "main" java.nio.file.AccessDeniedException: /home/jdoe/./mapper.py"

What should you do?

Solution (short version)
Change to a directory where the user can write files to. Retry the command.

Solution (long version)
Create a directory that is owned by the user and the group associated with the user that is running this command. For example, if you are trying to run the hadoop command with hduser, make sure you are in a subdirectory that is owned by the hduser. If you do not know the group this user is associated with, run the "groups" command.

Here is an example of the command that could help you:
chmod hduser:hadoop /path/to/foobar

Then move into foobar and run your hadoop command. Make sure the files in the foobar subdirectory are owned/associated by the user/group of the user that will run the command.

Leave a comment

Your email address will not be published. Required fields are marked *