猿问

hadoop没有用于方案的文件系统:file

我正在尝试NaiveBayesClassifer使用hadoop 运行一个简单的程序,出现此错误


Exception in thread "main" java.io.IOException: No FileSystem for scheme: file

    at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1375)

    at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:66)

    at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1390)

    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:196)

    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:95)

    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:180)

    at org.apache.hadoop.fs.Path.getFileSystem(Path.java:175)

    at org.apache.mahout.classifier.naivebayes.NaiveBayesModel.materialize(NaiveBayesModel.java:100)

代码:


    Configuration configuration = new Configuration();

    NaiveBayesModel model = NaiveBayesModel.materialize(new Path(modelPath), configuration);// error in this line..

modelPath指向NaiveBayes.bin文件,并且配置对象正在打印-Configuration: core-default.xml, core-site.xml


我认为是因为罐子,有什么想法吗?


翻阅古今
浏览 624回答 3
3回答

白衣染霜花

对于使用shade插件的用户,按照david_p的建议,您可以通过将ServicesResourceTransformer添加到插件配置中来合并阴影jar中的服务:&nbsp; <plugin>&nbsp; &nbsp; <groupId>org.apache.maven.plugins</groupId>&nbsp; &nbsp; <artifactId>maven-shade-plugin</artifactId>&nbsp; &nbsp; <version>2.3</version>&nbsp; &nbsp; <executions>&nbsp; &nbsp; &nbsp; <execution>&nbsp; &nbsp; &nbsp; &nbsp; <phase>package</phase>&nbsp; &nbsp; &nbsp; &nbsp; <goals>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <goal>shade</goal>&nbsp; &nbsp; &nbsp; &nbsp; </goals>&nbsp; &nbsp; &nbsp; &nbsp; <configuration>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <transformers>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </transformers>&nbsp; &nbsp; &nbsp; &nbsp; </configuration>&nbsp; &nbsp; &nbsp; </execution>&nbsp; &nbsp; </executions>&nbsp; </plugin>这会将所有org.apache.hadoop.fs.FileSystem服务合并到一个文件中
随时随地看视频慕课网APP

相关分类

Java
我要回答