我们正在尝试使用java进行sqoop导入,在我尝试从importtool中删除不推荐使用的com.cloudera.sqoop.sqoop选项之前,java可以正常工作,如下面的代码段所示。apache.sqoop.sqoopoptions可以替代cloudera.sqoop.sqoopoptions包,但importtool仅支持cloudera包,该包已被弃用。写这段代码的另一种方法是什么?请帮忙。
import org.apache.sqoop.tool.ImportTool;
import org.apache.sqoop.SqoopOptions;
import org.apache.sqoop.SqoopOptions.InvalidOptionsException;
//import com.cloudera.sqoop.SqoopOptions;
//import com.cloudera.sqoop.SqoopOptions.InvalidOptionsException;
public int sqoopImport(String name) throws ThrowIt {
try {
ImportTool importTool = new ImportTool();
SqoopOptions sqoopOptions = importTool.parseArguments(arg.toArray(new String[0]), configuration, null,
true);
importTool.validateOptions(sqoopOptions); //Error here, ImportTool needs sqoopOption from cloudera which is deprecated.
returnValue = importTool.run(sqoopOptions); //Error here, ImportTool needs sqoopOption from cloudera which is deprecated.
}
1条答案
按热度按时间bvn4nwqk1#
下载这个jar:- enter 此处链接说明
公共类testssh{
public static void main(字符串args[])引发异常{
} }