Exception in thread "main" java.io.IOException: Failed to set permissions of path

在跑BuildForest的时候,编写了下面的程序:

package test.breiman;

import org.apache.mahout.classifier.df.mapreduce.BuildForest;
/**
 * BuildForecast测试类
 * @author fansy
 */
public class BuildForestFollow {
	public static void main(String[] args) throws Exception{
		String[] arg=new String[]{
				"-d","hdfs://ubuntu:9000/user/breiman/input/glass.data",
				"-ds","hdfs://ubuntu:9000/user/breiman/glass.info",
				"-sl","5",
				"-p",
				"-t","10",
				"-o","hdfs://ubuntu:9000/user/mahout/output-forest1"
		};
		BuildForest.main(arg);
	}
}
结果一运行,就出现了下面的错误:

13/09/20 17:34:22 INFO mapreduce.BuildForest: Partial Mapred implementation
13/09/20 17:34:22 INFO mapreduce.BuildForest: Building the forest...
13/09/20 17:34:22 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
13/09/20 17:34:22 ERROR security.UserGroupInformation: PriviledgedActionException as:Administrator cause:java.io.IOException: Failed to set permissions of path: \tmp\hadoop-Administrator\mapred\staging\Administrator537639001\.staging to 0700
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-Administrator\mapred\staging\Administrator537639001\.staging to 0700
	at org.apache.hadoop.fs.FileUtil.checkReturnValue(FileUtil.java:689)
	at org.apache.hadoop.fs.FileUtil.setPermission(FileUtil.java:662)
	at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:509)
	at org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:344)
	at org.apache.hadoop.fs.FilterFileSystem.mkdirs(FilterFileSystem.java:189)
	at org.apache.hadoop.mapreduce.JobSubmissionFiles.getStagingDir(JobSubmissionFiles.java:116)
	at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:856)
	at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:415)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
	at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:850)
	at org.apache.hadoop.mapreduce.Job.submit(Job.java:500)
	at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:530)
	at org.apache.mahout.classifier.df.mapreduce.Builder.runJob(Builder.java:255)
	at org.apache.mahout.classifier.df.mapreduce.Builder.build(Builder.java:296)
	at org.apache.mahout.classifier.df.mapreduce.BuildForest.buildForest(BuildForest.java:229)
	at org.apache.mahout.classifier.df.mapreduce.BuildForest.run(BuildForest.java:189)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
	at org.apache.mahout.classifier.df.mapreduce.BuildForest.main(BuildForest.java:253)
	at test.breiman.BuildForestFollow.main(BuildForestFollow.java:18)
上网找,说是要替换hadoop的相关包,才行。但是我之前运行其他的Job都是ok的,所以这个问题还应该是其他,而非是网上的解决方式。之前遇到这个问题的时候解决了一次,但是当时没有记录下来,结果忘记了。晕。。。

这次的解决方式是,看BuildForest的源码,看到里面关于路径的设置是outputPath.getName();同时configuration是按照默认的。这样肯定是不行的,所以就修改相应的代码把outputPath.getName()改为outputPath.toString(),同时把configuration附上我主节点的相关信息,然后就可以了。


你可能感兴趣的:(Exception in thread "main" java.io.IOException: Failed to set permissions of path)