java - Hadoop Jar FileSystemNotFoundException
问题描述
我正在运行一个 hadoop 集群并尝试使用我发送到集群的 jar 文件运行 mapreduce 作业。问题是在某些节点上它成功而在其他节点上失败。我在某些节点上看到的错误是:
Exception in thread "main" java.nio.file.FileSystemNotFoundException
at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:183)
at com.sun.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:169)
at java.nio.file.Paths.get(Paths.java:154)
at customLib.readFile(CustomClass2.java:254)
at customLib.access$000(CustomClass2.java:210)
at customLib.getFieldOrder(CustomClass2.java:591)
at customLib.run(CustomClass1.java:177)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:90)
at customLib.main(CustomClass1.java:136)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.apache.hadoop.util.RunJar.run(RunJar.java:323)
at org.apache.hadoop.util.RunJar.main(RunJar.java:236)
我看到其他人也有类似的问题,例如这个问题的解决方案以及指向其他问题和解决方案的链接:java.nio.file.FileSystemNotFoundException when getting file from resources folder。但是,这些解决方案都不能解释为什么它可以在一个节点上运行而不是另一个节点上运行......这一定意味着我在某处有一些配置错误。
我检查了所有 hadoop xml 配置文件以及 $CLASSPATH、$PATH 和 java 运行时版本,一切似乎都是一样的。如果有人对我可以检查的内容有任何其他想法,将不胜感激 - 谢谢。
编辑:为了澄清,它试图获取的文件是打包在 JAR 中的资源。
解决方案
这个答案帮助了我:https ://stackoverflow.com/a/14607953/7969573 。看起来失败的节点在我的 CLASSPATH 中的 #HADOOP_HOME/share/hadoop/mapreduce/ 文件夹中具有我正在运行的类的 jar 副本。当我从应用程序调用的 shell 运行 jar 时,从节点中删除 jar 解决了这个问题。我本可以更新那个 jar 并且它也可以正常工作,但是在我当前的工作流程架构下删除它更有意义。
推荐阅读
- python - 有没有办法让 python 像游戏控制器一样工作?
- android - 在 kotlin 中作为参数使用默认参数
- laravel-backpack - 将导出和列可见性按钮移至顶部 CRUD 3.6.28
- json - 如何简化 JSON 到 GraphQL 突变解析器的 HTTP 发布
- php - 我有一个关于 JSON PHP 多值的问题
- c++ - 为什么我不能包含 SimpleITK.h 安装后不能包含在 C++ 中?
- javascript - 如何检查数组是否包含值,这是对象的属性?
- python - 学习 paython 3 hard way 练习 40
- javascript - 在 html javascript 中使用数据库中的数据
- ios - iOS 13 UITabBar 重新定位到顶部