Windows上运行第一个wordCount的时候报错Exception in thread “main“ 0: No such file or directory

水善利万物而不争,处众人之所恶,故几于道

文章目录

        • 完整报错如下:
        • 解决方案:
        • 原因分析:

完整报错如下:
2023-12-22 10:51:50,402 WARN [org.apache.hadoop.metrics2.impl.MetricsConfig] - Cannot locate configuration: tried hadoop-metrics2-jobtracker.properties,hadoop-metrics2.properties
2023-12-22 10:51:50,469 INFO [org.apache.hadoop.metrics2.impl.MetricsSystemImpl] - Scheduled Metric snapshot period at 10 second(s).
2023-12-22 10:51:50,469 INFO [org.apache.hadoop.metrics2.impl.MetricsSystemImpl] - JobTracker metrics system started
2023-12-22 10:51:51,441 WARN [org.apache.hadoop.mapreduce.JobResourceUploader] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this.
2023-12-22 10:51:51,449 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Cleaning up the staging area file:/tmp/hadoop/mapred/staging/Pepsi1413952253/.staging/job_local1413952253_0001
  Exception in thread "main" 0: No such file or directory
	at org.apache.hadoop.io.nativeio.NativeIO$POSIX.chmod(NativeIO.java:239)
	at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:836)
	at org.apache.hadoop.fs.ChecksumFileSystem$1.apply(ChecksumFileSystem.java:508)
	at org.apache.hadoop.fs.ChecksumFileSystem$FsOperation.run(ChecksumFileSystem.java:489)
	at org.apache.hadoop.fs.ChecksumFileSystem.setPermission(ChecksumFileSystem.java:511)
	at org.apache.hadoop.fs.FileSystem.mkdirs(FileSystem.java:676)
	at org.apache.hadoop.mapreduce.JobResourceUploader.mkdirs(JobResourceUploader.java:660)
	at org.apache.hadoop.mapreduce.JobResourceUploader.uploadResourcesInternal(JobResourceUploader.java:174)
	at org.apache.hadoop.mapreduce.JobResourceUploader.uploadResources(JobResourceUploader.java:135)
	at org.apache.hadoop.mapreduce.JobSubmitter.copyAndConfigureFiles(JobSubmitter.java:99)
	at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:194)
	at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1570)
	at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1567)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:422)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729)
	at org.apache.hadoop.mapreduce.Job.submit(Job.java:1567)
	at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1588)
	at com.daemon.mr.wordcount.WCDriver.main(WCDriver.java:37)

Process finished with exit code 1

解决方案:

以管理员方式运行idea就可以了

Windows上运行第一个wordCount的时候报错Exception in thread “main“ 0: No such file or directory_第1张图片

原因分析:

报错显示没有文件或目录。但是我非常确定我文件目录是存在的。

  Exception in thread "main" 0: No such file or directory
	at org.apache.hadoop.io.nativeio.NativeIO$POSIX.chmod(NativeIO.java:239)
	at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:836)

再往下看哪里抛出的异常,chmod、setPermission,猜想是不是没权限访问D盘所以找不到文件或目录。因此,以管理员身份运行idea,果然可以了…

你可能感兴趣的:(Hadoop,MapReduce,WordCount,找不到文件或目录)