- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试使用 JAVA 运行一个简单的 sqoop 导入程序。
我的程序:
String driver="com.vertica.Driver";
Configuration config = new Configuration();
config.addResource(new Path("/../../../mapred-site.xml"));
config.addResource(new Path("/../../../core-site.xml"));
config.addResource(new Path("/../../../hdfs-site.xml"));
SqoopOptions options = new SqoopOptions();
options.setConnectString(connection_string);
options.setDriverClassName(driver);
options.setUsername(username);
options.setPassword("xxxxxxxxxxxxx");
options.setTargetDir(directory path);
options.setFetchSize(0);
options.setSqlQuery("SELECT 123456 as runid, " +
"business_date " +
"FROM database.table " +
"WHERE business_date=\'20140922\' " +
"AND instrument_id=1037894110378941 " +
"AND $CONDITIONS");
int ret = new ImportTool().run(options);
System.out.println("Return Val: "+ret);
我有以下错误
15/02/03 02:26:23 WARN sqoop.ConnFactory: $SQOOP_CONF_DIR has not been set in the environment. Cannot check for additional configuration.
15/02/03 02:26:23 WARN sqoop.ConnFactory: Parameter --driver is set to an explicit driver however appropriate connection manager is not being set (via --connection-manager). Sqoop is going to fall back to org.apache.sqoop.manager.GenericJdbcManager. Please specify explicitly which connection manager should be used next time.
15/02/03 02:26:23 INFO tool.CodeGenTool: Beginning code generation
15/02/03 02:26:24 INFO manager.SqlManager: Executing SQL statement: SELECT 123456 as runid, business_date FROM silverscreen_qa.SS_INSTRUMENT WHERE business_date='20140922' AND instrument_id=1037894110378941 AND (1 = 0)
15/02/03 02:26:24 INFO manager.SqlManager: Executing SQL statement: SELECT 123456 as runid, business_date FROM silverscreen_qa.SS_INSTRUMENT WHERE business_date='20140922' AND instrument_id=1037894110378941 AND (1 = 0)
15/02/03 02:26:24 INFO orm.CompilationManager: $HADOOP_MAPRED_HOME is not set
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:11: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.JdbcWritableBridge;
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:12: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.DelimiterSet;
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:13: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.FieldFormatter;
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:14: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.RecordParser;
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:15: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.BooleanParser;
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:16: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.BlobRef;
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:17: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.ClobRef;
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:18: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.LargeObjectLoader;
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:19: error: package com.cloudera.sqoop.lib does not exist
import com.cloudera.sqoop.lib.SqoopRecord;
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:37: error: cannot find symbol
public class QueryResult extends SqoopRecord implements DBWritable, Writable {
^
symbol: class SqoopRecord
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:81: error: cannot find symbol
public void loadLargeObjects(LargeObjectLoader __loader)
^
symbol: class LargeObjectLoader
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:119: error: cannot find symbol
private final DelimiterSet __outputDelimiters = new DelimiterSet((char) 44, (char) 10, (char) 0, (char) 0, false);
^
symbol: class DelimiterSet
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:123: error: cannot find symbol
public String toString(DelimiterSet delimiters) {
^
symbol: class DelimiterSet
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:129: error: cannot find symbol
public String toString(DelimiterSet delimiters, boolean useRecordDelim) {
^
symbol: class DelimiterSet
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:140: error: cannot find symbol
private final DelimiterSet __inputDelimiters = new DelimiterSet((char) 44, (char) 10, (char) 0, (char) 0, false);
^
symbol: class DelimiterSet
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:141: error: cannot find symbol
private RecordParser __parser;
^
symbol: class RecordParser
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:142: error: package RecordParser does not exist
public void parse(Text __record) throws RecordParser.ParseError {
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:150: error: package RecordParser does not exist
public void parse(CharSequence __record) throws RecordParser.ParseError {
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:158: error: package RecordParser does not exist
public void parse(byte [] __record) throws RecordParser.ParseError {
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:166: error: package RecordParser does not exist
public void parse(char [] __record) throws RecordParser.ParseError {
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:174: error: package RecordParser does not exist
public void parse(ByteBuffer __record) throws RecordParser.ParseError {
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:182: error: package RecordParser does not exist
public void parse(CharBuffer __record) throws RecordParser.ParseError {
^
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:64: error: bad operand types for binary operator '=='
if (this == o) {
^
first type: QueryResult
second type: Object
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:67: error: inconvertible types
if (!(o instanceof QueryResult)) {
^
required: QueryResult
found: Object
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:70: error: inconvertible types
QueryResult that = (QueryResult) o;
^
required: QueryResult
found: Object
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:78: error: cannot find symbol
this.runid = JdbcWritableBridge.readLong(1, __dbResults);
^
symbol: variable JdbcWritableBridge
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:79: error: cannot find symbol
this.business_date = JdbcWritableBridge.readDate(2, __dbResults);
^
symbol: variable JdbcWritableBridge
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:89: error: cannot find symbol
JdbcWritableBridge.writeLong(runid, 1 + __off, -5, __dbStmt);
^
symbol: variable JdbcWritableBridge
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:90: error: cannot find symbol
JdbcWritableBridge.writeDate(business_date, 2 + __off, 91, __dbStmt);
^
symbol: variable JdbcWritableBridge
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:119: error: cannot find symbol
private final DelimiterSet __outputDelimiters = new DelimiterSet((char) 44, (char) 10, (char) 0, (char) 0, false);
^
symbol: class DelimiterSet
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:132: error: cannot find symbol
__sb.append(FieldFormatter.escapeAndEnclose(runid==null?"null":"" + runid, delimiters));
^
symbol: variable FieldFormatter
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:134: error: cannot find symbol
__sb.append(FieldFormatter.escapeAndEnclose(business_date==null?"null":"" + business_date, delimiters));
^
symbol: variable FieldFormatter
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:140: error: cannot find symbol
private final DelimiterSet __inputDelimiters = new DelimiterSet((char) 44, (char) 10, (char) 0, (char) 0, false);
^
symbol: class DelimiterSet
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:144: error: cannot find symbol
this.__parser = new RecordParser(__inputDelimiters);
^
symbol: class RecordParser
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:152: error: cannot find symbol
this.__parser = new RecordParser(__inputDelimiters);
^
symbol: class RecordParser
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:160: error: cannot find symbol
this.__parser = new RecordParser(__inputDelimiters);
^
symbol: class RecordParser
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:168: error: cannot find symbol
this.__parser = new RecordParser(__inputDelimiters);
^
symbol: class RecordParser
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:176: error: cannot find symbol
this.__parser = new RecordParser(__inputDelimiters);
^
symbol: class RecordParser
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:184: error: cannot find symbol
this.__parser = new RecordParser(__inputDelimiters);
^
symbol: class RecordParser
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:206: error: cannot find symbol
QueryResult o = (QueryResult) super.clone();
^
symbol: variable super
location: class QueryResult
/tmp/sqoop-sha0_dev/compile/bda7671a1a4e5e172248f2497654d2c1/QueryResult.java:208: error: incompatible types
return o;
^
required: Object
found: QueryResult
41 errors
15/02/03 02:26:24 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: Error returned by javac
at org.apache.sqoop.orm.CompilationManager.compile(CompilationManager.java:207)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:97)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:396)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:502)
at com.cts.rbc.archive.TestConnectionForHive.main(TestConnectionForHive.java:196)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
Return Val: 1
我尝试过的可能解决方案。
在我的 hadoop-env.sh 中 JAVA_HOME 的值是
JAVA_HOME=/usr/lib/jvm/java-1.7.0-oracle-1.7.0.65.x86_64
我知道这听起来很重复,但请相信我,我已经尝试了类似问题中提供的解决方案中描述的所有解决方案
我尝试使用以下代码更改 ~/.bashrc 中的 JAVA_HOME
JAVA_HOME=/etc/alternatives/java
这是在我的节点中安装最新 java 的地方它仍然会抛出相同的错误。
相同的查询在 bash 中有效。
注意:我无权将 hadoop-env.sh 中的 JAVA_HOME 更改为共享系统。
在 Java 程序中覆盖 JAVA_HOME 的可能方法?
最佳答案
[已解决]
无需更改 java_home(或)hadoop_mapred_home(或)sqoop_home
如错误所示,它无法找到 sqoop 库。而我在程序中使用了 sqoop 1.4.4 库。请注意,我没有使用任何构建工具(Maven、SBT 或任何东西)我正在使用普通的 eclipse 并将外部 .jar 添加到我的程序中。
在导出 .jar 时,我使用的是 Eclipse 标准方法(文件 -> 导出 -> Java -> 可运行 .jar 文件)
在启动配置中,我选择了合适的项目在库处理中,我使用了选项“将所需的库打包到生成的 JAR 中”
当我选择“将所需的库提取到生成的 JAR 中”并执行 .jar 文件时,它已成功执行。
关于bash - 遇到 IOException 运行导入作业 : java. io.IOException:javac 返回的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28293852/
我们有一个连接到某些网络服务的 Windows 窗体应用程序。它列出了系统中的文档,当用户双击一个文件时,我们将文件下载到本地计算机并打开文档供他们编辑。一旦用户关闭文档,我们就会将其上传回系统。 对
public class SampleCloseable implements AutoCloseable { private String name; public SampleCl
我正在尝试使用 JAVA 运行一个简单的 sqoop 导入程序。 我的程序: String driver="com.vertica.Driver"; Configuration con
我需要从 Java 执行一个外部程序(使用 libreoffice 将 fodt 文件转换为 pdf,就这样发生了)我知道该程序所需的精确命令行: /usr/bin/libreoffice --hea
AFAIK,标准try-with-resources 形式 try(InputStream is= new ...){ ... some reading from is } catch (..
我观察到这两种说法都是有效的。与第二个语句相比,第一个语句中记录的额外内容是什么? 最佳答案 第一个还记录原始异常(和堆栈跟踪),第二个仅记录消息。 因此,第一个语句中记录的“额外内容”是原始异常。这
我想执行重命名和删除功能,环境是LINUX。这是我正在使用的代码, String[] command_ary = { "/usr/bin/sh", "-c", command }; Runtime r
在使用 selenium webdriver 实现 Web 应用程序的自动化时,我遇到了一种情况,我需要上传文件并进一步继续。 我们为此使用 Java 和 Tcl 脚本语言。 下面是我的 TCL 代码
我正在尝试使用 ANT 将文件从一个目录复制到 Linux 上的另一个目录。 首先我使用了复制任务,它工作正常但文件模式没有保留。然后我改为使用 ,这就是我卡住的地方。 我的目标是这样的:
当我输入命令时: ./sqoop-import --connect jdbc:mysql://localhost/sqoop2 -table sqeep2 -m 1 -hive-import 当执行这
我正在使用 Sun 的 keytool 创建一个 Bouncy caSTLe keystore 并将证书导入其中。 keytool 确实会生成一个 Bouncy caSTLe 格式的 keystore
我正在执行下面的程序,它通过 java 调用 shell,我得到了异常请帮助我。 程序: import java.io.*; import java.util.*; public class Proc
我在我的一个项目中遇到了这个错误。 FAILURE: Build failed with an exception. What went wrong: Execution failed for tas
什么情况下read end可以死对偶PipedOutputStream和 PipedInputStream ?我没有关闭任何管道。 最佳答案 我遇到了java.io.IOException: Read
我有一段从文件中读取数据的代码。我想在此代码中强制 IOException 用于测试目的(我想检查代码在这种情况下是否抛出正确的自定义异常)。 例如,有什么方法可以创建一个防止被读取的文件?也许处理一
我为MapReduce文本排序编写了这样的代码: public static class SortMapper extends Mapper { private Text citizenshi
已关闭。此问题需要 debugging details 。目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and the
我要createNewFile有一条路径,但我得到了一个 IOException。问题是,详细的消息无法解释,我只能看到一堆问号。 我最初使用的是西类牙语的 Windows 10,但安装了中文语言包。
我认为这是基本的东西,但我不知道该怎么做。为什么我得到 IOException never throw in body of相应的 try 语句 public static void main(Str
我正在从 Java 项目中的类路径读取文件。 示例代码: public static Properties loadPropertyFile(String fileName) {
我是一名优秀的程序员,十分优秀!