Problem 1: After compilation is passed, the following error occurs during running:
[Html]
Hadoop @ springwater-Aspire-4743:/usr/local/hadoop/test $./test
Exception in thread "main" java. io. IOException: Mkdirs failed to create/my
At org. apache. hadoop. fs. ChecksumFileSystem. create (ChecksumFileSystem. java: 378)
At org. apache. hadoop. fs. ChecksumFileSystem. create (ChecksumFileSystem. java: 364)
At org. apache. hadoop. fs. FileSystem. create (FileSystem. java: 555)
At org. apache. hadoop. fs. FileSystem. create (FileSystem. java: 536)
Call to org. apache. hadoop. conf. fileSystem: create (Lorg/apache/hadoop/fs/Path; ZISJ) Lorg/apache/hadoop/fs/FSDataOutputStream;) failed!
Failed to open/my/t.txt for writing!
Hadoop @ springwater-Aspire-4743:/usr/local/hadoop/test $./test
Exception in thread "main" java. io. IOException: Mkdirs failed to create/my
At org. apache. hadoop. fs. ChecksumFileSystem. create (ChecksumFileSystem. java: 378)
At org. apache. hadoop. fs. ChecksumFileSystem. create (ChecksumFileSystem. java: 364)
At org. apache. hadoop. fs. FileSystem. create (FileSystem. java: 555)
At org. apache. hadoop. fs. FileSystem. create (FileSystem. java: 536)
Call to org. apache. hadoop. conf. fileSystem: create (Lorg/apache/hadoop/fs/Path; ZISJ) Lorg/apache/hadoop/fs/FSDataOutputStream;) failed!
Failed to open/my/t.txt for writing!
Cause analysis: the read and write permissions are insufficient.
Solution:
Sudo./test
However, there are new problems:
[Html]
Hadoop @ springwater-Aspire-4743:/usr/local/hadoop/test $ sudo./test
Environment variable CLASSPATH not set!
Environment variable CLASSPATH not set!
Failed to open/my/t.txt for writing!
Hadoop @ springwater-Aspire-4743:/usr/local/hadoop/test $ sudo./test
Environment variable CLASSPATH not set!
Environment variable CLASSPATH not set!
Failed to open/my/t.txt for writing!
Problem 2: sudo env found that I am in ~ /. The environment variable CLASSPATH defined in bashrc is not inherited by sudo.
So sudo./test will show that CLASSPATH is not defined
Solution:
In/etc/sudoers, modify:
Defaults env_reset
Is:
Defaults! Env_rese
Question 3: After I modify sudo chmod 777/etc/sudoers,
Another error occurs in sudo chmod 777/etc/sudoers:
[Html]
Springwater @ springwater-Aspire-4743:/etc $ sudo chmod 440 sudoers
Sudo: the mode of/etc/sudoers is 0777, which should be 0440
Sudo: no valid sudoers resource found. Exit
Sudo: Unable to initialize the policy plug-in
Springwater @ springwater-Aspire-4743:/etc $ sudo chmod 440 sudoers
Sudo: the mode of/etc/sudoers is 0777, which should be 0440
Sudo: no valid sudoers resource found. Exit
Sudo: Unable to initialize the policy plug-in
Solution:
Su root
Go to the root mode and modify the settings.