0

我正在尝试使用 Distcp Java API 将数据从一个 hadoop 集群复制到另一个集群。

但是我收到以下异常:

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.util.StringUtils.toLowerCase(Ljava/lang/String;)Ljava/lang/String;
at org.apache.hadoop.tools.util.DistCpUtils.getStrategy(DistCpUtils.java:126)
at org.apache.hadoop.tools.DistCp.createJob(DistCp.java:235)
at org.apache.hadoop.tools.DistCp.createAndSubmitJob(DistCp.java:174)
at org.apache.hadoop.tools.DistCp.execute(DistCp.java:153)
at com.monitor.BackupUtil.doBackup(BackupUtil.java:72)
at com.monitor.BackupUtil.main(BackupUtil.java:45)

我正在使用以下代码:

    public void doBackup() throws Exception {

    System.out.println("Beginning Distcp");
    DistCpOptions options = new DistCpOptions(
            new Path(prop.getProperty("sourceClusterDirectory") + "/" + prop.getProperty("tablename")
                    + "/distcp.txt"),
            new Path(prop.getProperty("targetCluster") + prop.getProperty("targetClusterDirectory")));

    System.out.println("Disctp between--->" + prop.getProperty("sourceClusterDirectory")+ "/distcp.txt" + "AND" + prop.getProperty("targetCluster")
            + prop.getProperty("targetClusterDirectory"));
    DistCp distcp = new DistCp(new Configuration(), options);
    Job job = distcp.execute();

    job.waitForCompletion(true);

    System.out.println("DistCp Completed Successfully");


}

我正在使用 hadoop 2.7.1,并且 distcp 依赖项是这样的:

<dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-distcp</artifactId>
        <version>2.7.1</version>
</dependency>
4

0 回答 0