【发布时间】:2016-05-24 07:12:04
【问题描述】:
使用 HBaseTestingUtility 我将启动一个小型集群。
testUtil = new HBaseTestingUtility(configuration);
testUtil.startMiniCluster();
并提供我的 jar 放在 DistributedCache 的类路径中
final String aJarResourcePath = Thread.currentThread().getContextClassLoader()
.getResource("abc/a-1.0.jar").getPath();
final FileSystem fs = FileSystem.get(configuration);
final Path pathToArtifacts = new Path("/Runtime/a-artifacts");
fs.mkdirs(pathToArtifacts);
fs.copyFromLocalFile(new Path(aJarResourcePath), pathToArtifacts));
DistributedCache.addFileToClassPath(disqualified, configuration);
在我的 MapFn 上,我使用的是 jar a-1.0.jar。我可以在 MapFn 中看到 jar
final Path[] fus = DistributedCache.getFileClassPaths(config);
所以我认为 jar 在类路径中并指向 HDFS 位置,但我得到 classnotfoundexception 试图创建一个对象。我不知道发生了什么请帮忙。
【问题讨论】:
标签: java hadoop jar classpath distributed-cache