Expected authority at index 7: hdfs://
来源:互联网 发布:微信上免费送礼品淘宝 编辑:程序博客网 时间:2024/06/14 23:30
hadoop版本:1.0.4
今天在跑TestForest的时候,居然出现了这个问题:
Exception in thread "main" java.lang.IllegalArgumentException: Expected authority at index 7: hdfs://at java.net.URI.create(URI.java:859)at org.apache.hadoop.fs.FileSystem.getDefaultUri(FileSystem.java:131)at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:123)at org.apache.mahout.classifier.df.mapreduce.Classifier.run(Classifier.java:107)at org.apache.mahout.classifier.df.mapreduce.TestForest.mapreduce(TestForest.java:187)at org.apache.mahout.classifier.df.mapreduce.TestForest.testForest(TestForest.java:173)at org.apache.mahout.classifier.df.mapreduce.TestForest.run(TestForest.java:145)at mahout.fansy.partial.test.TestTestForest.main(TestTestForest.java:26)Caused by: java.net.URISyntaxException: Expected authority at index 7: hdfs://at java.net.URI$Parser.fail(URI.java:2829)at java.net.URI$Parser.failExpecting(URI.java:2835)at java.net.URI$Parser.parseHierarchical(URI.java:3083)at java.net.URI$Parser.parse(URI.java:3034)at java.net.URI.<init>(URI.java:595)at java.net.URI.create(URI.java:857)... 7 more我调用TestForest的代码如下:
package mahout.fansy.partial.test;import org.apache.hadoop.conf.Configuration;import org.apache.mahout.classifier.df.mapreduce.TestForest;public class TestTestForest {/** * 测试TestForest * @param args * @throws Exception */public static void main(String[] args) throws Exception {String[] arg=new String[]{"-i","hdfs://ubuntu:9000/user/breiman/input/glass.data","-ds","hdfs://ubuntu:9000/user/breiman/glass.info","-m","hdfs://ubuntu:9000/user/breiman/glass.tree/forest.seq","-a","-mr","-o","hdfs://ubuntu:9000/user/breiman/out-testforest0"};Configuration conf=new Configuration();conf.set("mapred.job.tracker", "ubuntu:9001");conf.set("fs.default.name", "hdfs://");TestForest tf=new TestForest();tf.setConf(conf);Configuration confq=tf.getConf();System.out.println(confq);tf.run(arg);}}刚开始的时候是直接使用TestForest.main(arg)来调用的,但是发现conf的值设置不了(即全部都是按照默认,这个肯定不行,在win7 的myeclipse上面调用hadoop肯定要设置conf的)但是哪里可以设置,所以就想到了TestForest是继承Configuration的,然后Configuration有一个setConf的方法,所以就实例化了一个TestForest对象,然后调用setConf方法设置conf,但是conf设置的不对,所以出现了上面的错误。要如何设置呢?其实把conf.set("fs.default.name", "hdfs://");改为conf.set("fs.default.name", "ubuntu:9000");就可以了,其中ubuntu是主节点机器名。然后就可以跑了。
分享,成长,快乐
转载请注明blog地址:http://blog.csdn.net/fansy1990
- Expected authority at index 7: hdfs://
- Illegal character in authority at index 18:
- 【jsp】Fragment "/index.do?method=top" was not found at expected path
- Hadoop HDFS Wrong FS: hdfs:/ expected file:///
- index file smaller than expected
- Wrong FS: hdfs:/ expected: file:///
- Wrong FS: hdfs:, expected:file:///
- Wrong FS: hdfs://******, expected: file:///
- Wrong FS: hdfs expected: file:
- ViewDoesNotExist at /index/
- Missing IN or OUT parameter at index:: 7
- git error:index file smaller than expected
- git fatal: index file smaller than expected
- Expected value at 1:0 Expected value at 2:0 Expected value at xx:xx错误的解决
- HDFS 的Java操作“ Wrong FS: hdfs://xxx, expected: file:///”
- Bareword found where operator expected at 错误
- error: expected declaration or statement at end
- Puppet的错误Syntax error at ''; expected '' at
- 数据结构与算法分析:第一章:Finding the kth largest number and The four basic rules of recursion
- C#_delegate - 用委托实现事件,Display和Log类都使用Clock对象
- (void) (&_x == &_y)
- Ruby中,&:(ampersand-colon,"与号-冒号")的用法
- C#:System.Array简单使用
- Expected authority at index 7: hdfs://
- 初识Linux—3
- MFC--SendMessage、PostMessage原理
- 计算机科学中最重要的32个算法
- C语言与金属材料
- 为什么本机上无法用127.0.0.1登录SQL Server
- 【Android】“微信”apk中的“发现”和“我”两个模块的布局
- MFC--CStdioFile类和CFile类的区别
- Python之美[从菜鸟到高手]--urllib源码分析