我使用Disributed Cache将.jar文件添加到类路径:
DistributedCache.addFileToClassPath(new Path("binary/tools.jar"), job.getConfiguration());
Run Code Online (Sandbox Code Playgroud)
我不确定addFileToClassPath()是否是用于将.jar文件添加到类路径的正确API.当我尝试从映射器中检索类路径时,我看不到添加的jar.类路径包含作业的工作目录(jobcache dir),但不包括通过分布式缓存分发的jar.
Properties prop = System.getProperties();
System.out.println("The classpath is: " + prop.getProperty("java.class.path", null));
Run Code Online (Sandbox Code Playgroud)
我也尝试了addArchiveToClassPath()..它没有工作..
我错过了什么吗?
谢谢,
问题出在路径上.addFileToClassPath()或addArchiveToClassPath()仅采用绝对路径作为输入.binary/tools.jar是相对的,因此不起作用.我需要指定路径,因为/user/<username>/binary/tools.jar.. 它工作正常.甚至hdfs://<hostname>:port/user/..失败了.
谢谢你们..
| 归档时间: |
|
| 查看次数: |
3694 次 |
| 最近记录: |