Various problems and solutions encountered when the C program accesses hadoop

Source: Internet
Author: User

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.